{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 内置函数（按照字母顺序）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# abs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "11\n"
     ]
    }
   ],
   "source": [
    "# abs 取绝对值\n",
    "print(abs(-11))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# all\n",
    "all() 函数用于判断给定的可迭代参数 iterable 中的所有元素是否都为 TRUE，如果是返回 True，否则返回 False。<br>\n",
    "元素除了是 0、空、FALSE 外都算 TRUE。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# all\n",
    "all(range(1,10,1))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# any\n",
    "any() 函数用于判断给定的可迭代参数 iterable 是否全部为 False，则返回 False，如果有一个为 True，则返回 True。\n",
    "元素除了是 0、空、FALSE 外都算 TRUE。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "any([None]*10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# ascii\n",
    "ascii() 函数类似 repr() 函数, 返回一个表示对象的字符串, 但是对于字符串中的非 ASCII 字符则返回通过 repr() 函数使用 \\x, \\u 或 \\U 编码的字符。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"'\\\\ni love python\\\\ni lvoe quant\\\\ni wana be a quanter\\\\n'\""
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ascii(\"\"\"\n",
    "i love python\n",
    "i lvoe quant\n",
    "i wana be a quanter\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "i love python\n",
      "i lvoe quant\n",
      "i wana be a quanter\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print('\\ni love python\\ni lvoe quant\\ni wana be a quanter\\n')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# bin\n",
    "bin() 返回一个整数 int 或者长整数 long int 的二进制表示。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'0b1010'"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bin(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# bool\n",
    "bool() 函数用于将给定参数转换为布尔类型，如果没有参数，返回 False。<br>\n",
    "bool 是 int 的子类。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bool(0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "issubclass(bool,int)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# bytearray\n",
    "bytearray() 方法返回一个新字节数组。这个数组里的元素是可变的，并且每个元素的值范围: 0 <= x < 256。<br>\n",
    "bytearray()方法语法：\n",
    "```python\n",
    "class bytearray([source[, encoding[, errors]]])\n",
    "```\n",
    "* 如果 source 为整数，则返回一个长度为 source 的初始化数组；\n",
    "* 如果 source 为字符串，则按照指定的 encoding 将字符串转换为字节序列；\n",
    "* 如果 source 为可迭代类型，则元素必须为[0 ,255] 中的整数；\n",
    "* 如果 source 为与 buffer 接口一致的对象，则此对象也可以被用于初始化 bytearray。\n",
    "* 如果没有输入任何参数，默认就是初始化数组为0个元素。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "bytearray(b'quant')"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bytearray()\n",
    "bytearray(range(3))\n",
    "bytearray('quant','utf-8')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# bytes \n",
    "bytes 函数返回一个新的 bytes 对象，该对象是一个 0 <= x < 256 区间内的整数不可变序列。它是 bytearray 的不可变版本。<br>\n",
    "以下是 bytes 的语法:\n",
    "```python\n",
    "class bytes([source[, encoding[, errors]]])\n",
    "```\n",
    "* 如果 source 为整数，则返回一个长度为 source 的初始化数组；\n",
    "* 如果 source 为字符串，则按照指定的 encoding 将字符串转换为字节序列；\n",
    "* 如果 source 为可迭代类型，则元素必须为[0 ,255] 中的整数；\n",
    "* 如果 source 为与 buffer 接口一致的对象，则此对象也可以被用于初始化 bytearray。\n",
    "* 如果没有输入任何参数，默认就是初始化数组为0个元素。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "b'\\x00\\x01\\x02'\n"
     ]
    }
   ],
   "source": [
    "print(bytes(range(3)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'bytes'>\n"
     ]
    }
   ],
   "source": [
    "print(type(bytes(range(3))))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "b'quant'\n"
     ]
    }
   ],
   "source": [
    "print(bytes('quant','utf-8'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'bytes'>\n"
     ]
    }
   ],
   "source": [
    "print(type(bytes('quant','utf-8')))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# callable\n",
    "callable() 函数用于检查一个对象是否是可调用的。如果返回True，object仍然可能调用失败；但如果返回False，调用对象ojbect绝对不会成功。\n",
    "对于函数, 方法, lambda 函式, 类, 以及实现了 \\__call__ 方法的类实例, 它都返回 True。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "callable('quant')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "def show():\n",
    "    print(\"hello quanter\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello quanter\n"
     ]
    }
   ],
   "source": [
    "show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "callable(show)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "class A():\n",
    "    def show():\n",
    "        print('hello quant')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "callable(A)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "a=A()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "callable(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "class B():\n",
    "    def show():\n",
    "         print('hello quant')\n",
    "    def __call__(self):\n",
    "        return 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "callable(B)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b=B()\n",
    "callable(b)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# chr\n",
    "chr() 用一个范围在 range（256）内的（就是0～255）整数作参数，返回一个对应的字符。<br>\n",
    "以下是 chr() 方法的语法:\n",
    "```python\n",
    "chr(i)\n",
    "```\n",
    "i -- 可以是10进制也可以是16进制的形式的数字。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 2\n",
      "Y [ Z\n"
     ]
    }
   ],
   "source": [
    "print(chr(0x30),chr(0x32))\n",
    "print(chr(89),chr(91),chr(90))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# classmethod \n",
    "classmethod 修饰符对应的函数不需要实例化，不需要 self 参数，但第一个参数需要是表示自身类的 cls 参数，可以来调用类的属性，类的方法，实例化对象等。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "class K():\n",
    "    name=\"K线\"\n",
    "    def colour(self,n):\n",
    "        print('{0}的颜色是：{1}'.format(self.name,n))\n",
    "    @classmethod\n",
    "    def show(cls):\n",
    "        print('classmethod')\n",
    "        print(cls.name)\n",
    "        cls().colour('green')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "classmethod\n",
      "K线\n",
      "K线的颜色是：green\n"
     ]
    }
   ],
   "source": [
    "K.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# compile\n",
    "ompile() 函数将一个字符串编译为字节代码。<br>\n",
    "以下是 compile() 方法的语法:\n",
    "```python\n",
    "compile(source, filename, mode[, flags[, dont_inherit]])\n",
    "```\n",
    "\n",
    "* source -- 字符串或者AST（Abstract Syntax Trees）对象。。\n",
    "* filename -- 代码文件名称，如果不是从文件读取代码则传递一些可辨认的值。\n",
    "* mode -- 指定编译代码的种类。可以指定为 exec, eval, single。\n",
    "* flags -- 变量作用域，局部命名空间，如果被提供，可以是任何映射对象。。\n",
    "* flags和dont_inherit是用来控制编译源码时的标志\n",
    "<br>\n",
    "返回表达式执行结果。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "code"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s=\"\"\"\n",
    "for i in range(11):\n",
    "    print(i,end=',')\n",
    "print('end')\n",
    "\"\"\"\n",
    "c=compile(s,'','exec')\n",
    "type(c)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0,1,2,3,4,5,6,7,8,9,10,end\n"
     ]
    }
   ],
   "source": [
    "exec(c)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "23"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s='3+4*5'\n",
    "eval(compile(s,\"\",\"eval\"))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# complex\n",
    "complex() 函数用于创建一个值为 real + imag * j 的复数或者转化一个字符串或数为复数。如果第一个参数为字符串，则不需要指定第二个参数。。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1+2j)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "complex(1,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(11+0j)"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "complex(11)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1+0j)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "complex(\"1\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1+2j)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "complex(\"1+2j\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# delattr\n",
    "delattr 函数用于删除属性。<br>\n",
    "delattr(x, 'foobar') 相等于 del x.foobar。<br>\n",
    "语法：<br>\n",
    "```python\n",
    "delattr(object, name)\n",
    "```\n",
    "object -- 对象。<br>\n",
    "name -- 必须是对象的属性。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "class K():\n",
    "    colour=\"green\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "k=K()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'green'"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "k.colour"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "delattr(K,'colour')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'K' object has no attribute 'colour'",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-28-1f1f813f37da>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mk\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcolour\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m: 'K' object has no attribute 'colour'"
     ],
     "output_type": "error"
    }
   ],
   "source": [
    "k.colour"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# dict\n",
    "dict() 函数用于创建一个字典。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# dir\n",
    "dir() 函数不带参数时，返回当前范围内的变量、方法和定义的类型列表；带参数时，返回参数的属性、方法列表。如果参数包含方法__dir__()，该方法将被调用。如果参数不包含__dir__()，该方法将最大限度地收集参数信息。<br>\n",
    "语法：<br>\n",
    "```python\n",
    "dir([object])\n",
    "```\n",
    "object -- 对象、变量、类型。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['In',\n",
       " 'K',\n",
       " 'Out',\n",
       " '_',\n",
       " '_13',\n",
       " '_15',\n",
       " '_16',\n",
       " '_17',\n",
       " '_18',\n",
       " '_19',\n",
       " '_20',\n",
       " '_21',\n",
       " '_26',\n",
       " '__',\n",
       " '___',\n",
       " '__builtin__',\n",
       " '__builtins__',\n",
       " '__doc__',\n",
       " '__loader__',\n",
       " '__name__',\n",
       " '__package__',\n",
       " '__spec__',\n",
       " '_dh',\n",
       " '_i',\n",
       " '_i1',\n",
       " '_i10',\n",
       " '_i11',\n",
       " '_i12',\n",
       " '_i13',\n",
       " '_i14',\n",
       " '_i15',\n",
       " '_i16',\n",
       " '_i17',\n",
       " '_i18',\n",
       " '_i19',\n",
       " '_i2',\n",
       " '_i20',\n",
       " '_i21',\n",
       " '_i22',\n",
       " '_i23',\n",
       " '_i24',\n",
       " '_i25',\n",
       " '_i26',\n",
       " '_i27',\n",
       " '_i28',\n",
       " '_i29',\n",
       " '_i3',\n",
       " '_i4',\n",
       " '_i5',\n",
       " '_i6',\n",
       " '_i7',\n",
       " '_i8',\n",
       " '_i9',\n",
       " '_ih',\n",
       " '_ii',\n",
       " '_iii',\n",
       " '_oh',\n",
       " 'c',\n",
       " 'exit',\n",
       " 'get_ipython',\n",
       " 'i',\n",
       " 'k',\n",
       " 'quit',\n",
       " 's']"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dir()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['__add__',\n",
       " '__class__',\n",
       " '__contains__',\n",
       " '__delattr__',\n",
       " '__delitem__',\n",
       " '__dir__',\n",
       " '__doc__',\n",
       " '__eq__',\n",
       " '__format__',\n",
       " '__ge__',\n",
       " '__getattribute__',\n",
       " '__getitem__',\n",
       " '__gt__',\n",
       " '__hash__',\n",
       " '__iadd__',\n",
       " '__imul__',\n",
       " '__init__',\n",
       " '__init_subclass__',\n",
       " '__iter__',\n",
       " '__le__',\n",
       " '__len__',\n",
       " '__lt__',\n",
       " '__mul__',\n",
       " '__ne__',\n",
       " '__new__',\n",
       " '__reduce__',\n",
       " '__reduce_ex__',\n",
       " '__repr__',\n",
       " '__reversed__',\n",
       " '__rmul__',\n",
       " '__setattr__',\n",
       " '__setitem__',\n",
       " '__sizeof__',\n",
       " '__str__',\n",
       " '__subclasshook__',\n",
       " 'append',\n",
       " 'clear',\n",
       " 'copy',\n",
       " 'count',\n",
       " 'extend',\n",
       " 'index',\n",
       " 'insert',\n",
       " 'pop',\n",
       " 'remove',\n",
       " 'reverse',\n",
       " 'sort']"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dir(list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "def a():\n",
    "    print(\"quant\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['__annotations__',\n",
       " '__call__',\n",
       " '__class__',\n",
       " '__closure__',\n",
       " '__code__',\n",
       " '__defaults__',\n",
       " '__delattr__',\n",
       " '__dict__',\n",
       " '__dir__',\n",
       " '__doc__',\n",
       " '__eq__',\n",
       " '__format__',\n",
       " '__ge__',\n",
       " '__get__',\n",
       " '__getattribute__',\n",
       " '__globals__',\n",
       " '__gt__',\n",
       " '__hash__',\n",
       " '__init__',\n",
       " '__init_subclass__',\n",
       " '__kwdefaults__',\n",
       " '__le__',\n",
       " '__lt__',\n",
       " '__module__',\n",
       " '__name__',\n",
       " '__ne__',\n",
       " '__new__',\n",
       " '__qualname__',\n",
       " '__reduce__',\n",
       " '__reduce_ex__',\n",
       " '__repr__',\n",
       " '__setattr__',\n",
       " '__sizeof__',\n",
       " '__str__',\n",
       " '__subclasshook__']"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dir(a)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# divmod(a, b)\n",
    " divmod() 函数把除数和余数运算结果结合起来，返回一个包含商和余数的元组"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3, 1)"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "divmod(10,3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# enumerate\n",
    "enumerate() 函数用于将一个可遍历的数据对象(如列表、元组或字符串)组合为一个索引序列，同时列出数据和数据下标，一般用在 for 循环当中。<br>\n",
    "以下是 enumerate() 方法的语法:<br>\n",
    "```python\n",
    "enumerate(sequence, [start=0])\n",
    "```\n",
    "sequence -- 一个序列、迭代器或其他支持迭代对象。<br>\n",
    "start -- 下标起始位置。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [],
   "source": [
    "r=range(11)\n",
    "e=enumerate(r,10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[]"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(e)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10:0\n",
      "11:1\n",
      "12:2\n",
      "13:3\n",
      "14:4\n",
      "15:5\n",
      "16:6\n",
      "17:7\n",
      "18:8\n",
      "19:9\n",
      "20:10\n"
     ]
    }
   ],
   "source": [
    "for i,j in e:\n",
    "    print(\"{}:{}\".format(i,j))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# eval\n",
    "eval() 函数用来执行一个字符串表达式，并返回表达式的值。<br>\n",
    "语法:<br>\n",
    "```python\n",
    "eval(expression[, globals[, locals]])\n",
    "```\n",
    "expression -- 表达式。<br>\n",
    "globals -- 变量作用域，全局命名空间，如果被提供，则必须是一个字典对象。<br>\n",
    "locals -- 变量作用域，局部命名空间，如果被提供，可以是任何映射对象。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "14"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eval('7+7')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "11\n"
     ]
    }
   ],
   "source": [
    "x=11\n",
    "eval('print(x)')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "15"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eval('4+x')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# exec \n",
    "exec 执行储存在字符串或文件中的 Python 语句，相比于 eval，exec可以执行更复杂的 Python 代码。<br>\n",
    "语法:<br>\n",
    "```python\n",
    "exec(object[, globals[, locals]])\n",
    "```\n",
    "object：必选参数，表示需要被指定的Python代码。它必须是字符串或code对象。如果object是一个字符串，该字符串会先被解析为一组Python语句，然后在执行（除非发生语法错误）。如果object是一个code对象，那么它只是被简单的执行。<br>\n",
    "globals：可选参数，表示全局命名空间（存放全局变量），如果被提供，则必须是一个字典对象。<br>\n",
    "locals：可选参数，表示当前局部命名空间（存放局部变量），如果被提供，可以是任何映射对象。如果该参数被忽略，那么它将会取与globals相同的值。<br>\n",
    "**返回值**<br>\n",
    "exec 返回值永远为 None。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "11\n"
     ]
    }
   ],
   "source": [
    "x=11\n",
    "exec('print(x)')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [],
   "source": [
    "exec('7+7')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0,1,2,3,4,5,6,7,8,9,10,end\n"
     ]
    }
   ],
   "source": [
    "s=\"\"\"\n",
    "for i in range(11):\n",
    "    print(i,end=',')\n",
    "print('end')\n",
    "\"\"\"\n",
    "exec(s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0,1,2,3,4,5,6,7,8,9,end\n"
     ]
    }
   ],
   "source": [
    "s=\"\"\"\n",
    "for i in range(x):\n",
    "    print(i,end=',')\n",
    "print('end')\n",
    "\"\"\"\n",
    "exec(s,{'x':10})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# filter\n",
    "filter() 函数用于过滤序列，过滤掉不符合条件的元素，返回由符合条件元素组成的新列表。<br>\n",
    "该接收两个参数，第一个为函数，第二个为序列，序列的每个元素作为参数传递给函数进行判，然后返回 True 或 False，最后将返回 True 的元素放到新列表中。<br>\n",
    "语法:<br>\n",
    "```python\n",
    "filter(function, iterable)\n",
    "```\n",
    "function -- 判断函数。<br>\n",
    "iterable -- 可迭代对象。<br>\n",
    "返回列表。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98]"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(filter(lambda x:x % 7==0,range(100)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# float\n",
    "float() 函数用于将整数和字符串转换成浮点数."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'float'>\n"
     ]
    }
   ],
   "source": [
    "print(type(float(1)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "12.3\n"
     ]
    }
   ],
   "source": [
    "print(float(\"12.3\"))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# format\n",
    "格式化函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'quant trade'"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"{} {}\".format('quant','trade') # 不设置指定位置，按照默认顺序调用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'trade quant quant'"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"{1} {0} {0}\".format('quant','trade')# 设置指定位置"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'第一个参数是trade，第二个参数是quant,两个参数组合是：trade&quant'"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 设置参数\n",
    "\"第一个参数是{first}，第二个参数是{second},两个参数组合是：{first}&{second}\".format(second='quant',first='trade')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "class A():\n",
    "    name='class a'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'class a'"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"{a.name}\".format(a=A())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数字格式化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "ls=[(3.1415926,\"{:.2f}\",\"保留小数点后两位\")\n",
    ",(3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\")\n",
    ",(-1,\"{:+.2f}\",\"带符号保留小数点后两位\")\n",
    ",(2.71828,\"{:.0f}\",\"不带小数\")\n",
    ",(5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\")\n",
    ",(5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\n",
    ",(10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\n",
    ",(1000000,\"{:,}\",\"以逗号分隔的数字格式\")\n",
    ",(0.25,\"{:.2%}\",\"百分比格式\")\n",
    ",(1000000000,\"{:.2e}\",\"指数记法\")\n",
    ",(13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\")\n",
    ",(13,\"{:<10d}\",\"左对齐 (宽度为10)\")\n",
    ",(13,\"{:^10d}\",\"中间对齐 (宽度为10)\")\n",
    ",(11,\"{:b}\",\"二进制\")\n",
    ",(11,\"{:d}\",\"十进制\")\n",
    ",(11,\"{:o}\",\"八进制\")\n",
    ",(11,\"{:x}\",\"十六进制\")\n",
    ",(11,\"{:#x}\",\"十六进制\")\n",
    ",(11,\"{:#X}\",\"十六进制\")\n",
    "]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "原始数值:   3.1415926,格式:{:.2f}    ,格式数值:3.14           ,格式描述:保留小数点后两位\n",
      "原始数值:   3.1415926,格式:{:+.2f}   ,格式数值:+3.14          ,格式描述:带符号保留小数点后两位\n",
      "原始数值:          -1,格式:{:+.2f}   ,格式数值:-1.00          ,格式描述:带符号保留小数点后两位\n",
      "原始数值:     2.71828,格式:{:.0f}    ,格式数值:3              ,格式描述:不带小数\n",
      "原始数值:           5,格式:{:0>2d}   ,格式数值:05             ,格式描述:数字补零 (填充左边, 宽度为2)\n",
      "原始数值:           5,格式:{:x<4d}   ,格式数值:5xxx           ,格式描述:数字补x (填充右边, 宽度为4)\n",
      "原始数值:          10,格式:{:x<4d}   ,格式数值:10xx           ,格式描述:数字补x (填充右边, 宽度为4)\n",
      "原始数值:     1000000,格式:{:,}      ,格式数值:1,000,000      ,格式描述:以逗号分隔的数字格式\n",
      "原始数值:        0.25,格式:{:.2%}    ,格式数值:25.00%         ,格式描述:百分比格式\n",
      "原始数值:  1000000000,格式:{:.2e}    ,格式数值:1.00e+09       ,格式描述:指数记法\n",
      "原始数值:          13,格式:{:10d}    ,格式数值:        13     ,格式描述:右对齐 (默认, 宽度为10)\n",
      "原始数值:          13,格式:{:<10d}   ,格式数值:13             ,格式描述:左对齐 (宽度为10)\n",
      "原始数值:          13,格式:{:^10d}   ,格式数值:    13         ,格式描述:中间对齐 (宽度为10)\n",
      "原始数值:          11,格式:{:b}      ,格式数值:1011           ,格式描述:二进制\n",
      "原始数值:          11,格式:{:d}      ,格式数值:11             ,格式描述:十进制\n",
      "原始数值:          11,格式:{:o}      ,格式数值:13             ,格式描述:八进制\n",
      "原始数值:          11,格式:{:x}      ,格式数值:b              ,格式描述:十六进制\n",
      "原始数值:          11,格式:{:#x}     ,格式数值:0xb            ,格式描述:十六进制\n",
      "原始数值:          11,格式:{:#X}     ,格式数值:0XB            ,格式描述:十六进制\n"
     ]
    }
   ],
   "source": [
    "for i in ls:\n",
    "    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:15},格式描述:{disc}\"\n",
    "          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "^, <, > 分别是居中、左对齐、右对齐，后面带宽度， : 号后面带填充的字符，只能是一个字符，不指定则默认是用空格填充。<br>\n",
    "\\+ 表示在正数前显示 +，负数前显示 -；  （空格）表示在正数前加空格<br>\n",
    "b、d、o、x 分别是二进制、十进制、八进制、十六进制。<br>\n",
    "此外我们可以使用大括号 {} 来转义大括号<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'后面是一个大括号{}'"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"{}{{}}\".format(\"后面是一个大括号\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# frozenset\n",
    "frozenset() 返回一个冻结的集合，冻结后集合不能再添加或删除任何元素。<br>\n",
    "语法：\n",
    "```python\n",
    "class frozenset([iterable])\n",
    "```\n",
    "iterable -- 可迭代的对象，比如列表、字典、元组等等。<br>\n",
    "返回新的 frozenset 对象，如果不提供任何参数，默认会生成空集合。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "x=frozenset(range(11))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "frozenset({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10})"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['__and__',\n",
       " '__class__',\n",
       " '__contains__',\n",
       " '__delattr__',\n",
       " '__dir__',\n",
       " '__doc__',\n",
       " '__eq__',\n",
       " '__format__',\n",
       " '__ge__',\n",
       " '__getattribute__',\n",
       " '__gt__',\n",
       " '__hash__',\n",
       " '__init__',\n",
       " '__init_subclass__',\n",
       " '__iter__',\n",
       " '__le__',\n",
       " '__len__',\n",
       " '__lt__',\n",
       " '__ne__',\n",
       " '__new__',\n",
       " '__or__',\n",
       " '__rand__',\n",
       " '__reduce__',\n",
       " '__reduce_ex__',\n",
       " '__repr__',\n",
       " '__ror__',\n",
       " '__rsub__',\n",
       " '__rxor__',\n",
       " '__setattr__',\n",
       " '__sizeof__',\n",
       " '__str__',\n",
       " '__sub__',\n",
       " '__subclasshook__',\n",
       " '__xor__',\n",
       " 'copy',\n",
       " 'difference',\n",
       " 'intersection',\n",
       " 'isdisjoint',\n",
       " 'issubset',\n",
       " 'issuperset',\n",
       " 'symmetric_difference',\n",
       " 'union']"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dir(frozenset)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# getattr\n",
    "getattr() 函数用于返回一个对象属性值。<br>\n",
    "语法：\n",
    "```python\n",
    "getattr(object, name[, default])\n",
    "```\n",
    "object -- 对象。<br>\n",
    "name -- 字符串，对象属性。<br>\n",
    "default -- 默认返回值，如果不提供该参数，在没有对应属性时，将触发 AttributeError。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Order():\n",
    "    id=1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "getattr(Order(),'id')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'None'"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "getattr(Order(),'ids',\"None\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# globals\n",
    "globals() 函数会以字典类型返回当前位置的全部全局变量。<br>\n",
    "语法：\n",
    "```python\n",
    "globals()\n",
    "```\n",
    "返回全局变量的字典。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'__name__': '__main__', '__doc__': 'Automatically created module for IPython interactive environment', '__package__': None, '__loader__': None, '__spec__': None, '__builtin__': <module 'builtins' (built-in)>, '__builtins__': <module 'builtins' (built-in)>, '_ih': ['', 'print(float(1))', 'print(type(float(1)))', 'type(float(\"12,3\"))', 'type(float(\"12.3\"))', 'print(float(\"12.3\"))', '\"{} {}\".format(\\'quant\\',\\'trade\\')', '\"{0} {1}\".format(\\'quant\\',\\'trade\\')', '\"{1} {0}\".format(\\'quant\\',\\'trade\\')', '\"{1} {0} {0}\".format(\\'quant\\',\\'trade\\')', '\"{} {} {}\".format(\\'quant\\',\\'trade\\') # 不设置指定位置，按照默认顺序调用', '\"{} {}\".format(\\'quant\\',\\'trade\\') # 不设置指定位置，按照默认顺序调用', '\"{1} {0} {0}\".format(\\'quant\\',\\'trade\\')# 设置指定位置', '# 设置参数\\n\"第一个参数是{first}，第二个参数是{second}\".format(secont=\\'quant\\',first=\\'trade\\')', '# 设置参数\\n\"第一个参数是{first}，第二个参数是{second}\".format(second=\\'quant\\',first=\\'trade\\')', '# 设置参数\\n\"第一个参数是{first}，第二个参数是{second},两个参数组合是：{first}&{second}\".format(second=\\'quant\\',first=\\'trade\\')', \"class A():\\n    name='class a'\", '\"{a.name}\".format(a=A())', 'ls=[3.1415926,\"{:.2f}\",\"保留小数点后两位\"\\n3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\"\\n-1,\"{:+.2f}\",\"带符号保留小数点后两位\"\\n2.71828,\"{:.0f}\",\"不带小数\"\\n5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\"\\n5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\"\\n10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\"\\n1000000,\"{:,}\",\"以逗号分隔的数字格式\"\\n0.25,\"{:.2%}\",\"百分比格式\"\\n1000000000,\"{:.2e}\",\"指数记法\"\\n13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\"\\n13,\"{:<10d}\",\"左对齐 (宽度为10)\"\\n13,\"{:^10d}\",\"中间对齐 (宽度为10)\"\\n11,\"{:b}\",\"二进制\"\\n11,\"{:d}\",\"十进制\"\\n11,\"{:o}\",\"八进制\"\\n11,\"{:x}\",\"十六进制\"\\n11,\"{:#x}\",\"十六进制\"\\n11,\"{:#X}\",\"十六进制\"]', 'ls=[(3.1415926,\"{:.2f}\",\"保留小数点后两位\")\\n(3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n(-1,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n(2.71828,\"{:.0f}\",\"不带小数\")\\n(5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\")\\n(5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n(10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n(1000000,\"{:,}\",\"以逗号分隔的数字格式\")\\n(0.25,\"{:.2%}\",\"百分比格式\")\\n(1000000000,\"{:.2e}\",\"指数记法\")\\n(13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\")\\n(13,\"{:<10d}\",\"左对齐 (宽度为10)\")\\n(13,\"{:^10d}\",\"中间对齐 (宽度为10)\")\\n(11,\"{:b}\",\"二进制\")\\n(11,\"{:d}\",\"十进制\")\\n(11,\"{:o}\",\"八进制\")\\n(11,\"{:x}\",\"十六进制\")\\n(11,\"{:#x}\",\"十六进制\")\\n(11,\"{:#X}\",\"十六进制\")\\n]', 'ls=[(3.1415926,\"{:.2f}\",\"保留小数点后两位\")\\n,(3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(-1,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(2.71828,\"{:.0f}\",\"不带小数\")\\n,(5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\")\\n,(5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(1000000,\"{:,}\",\"以逗号分隔的数字格式\")\\n,(0.25,\"{:.2%}\",\"百分比格式\")\\n,(1000000000,\"{:.2e}\",\"指数记法\")\\n,(13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\")\\n,(13,\"{:<10d}\",\"左对齐 (宽度为10)\")\\n,(13,\"{:^10d}\",\"中间对齐 (宽度为10)\")\\n,(11,\"{:b}\",\"二进制\")\\n,(11,\"{:d}\",\"十进制\")\\n,(11,\"{:o}\",\"八进制\")\\n,(11,\"{:x}\",\"十六进制\")\\n,(11,\"{:#x}\",\"十六进制\")\\n,(11,\"{:#X}\",\"十六进制\")\\n]', 'ls=[(3.1415926,\"{:.2f}\",\"保留小数点后两位\")\\n,(3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(-1,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(2.71828,\"{:.0f}\",\"不带小数\")\\n,(5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\")\\n,(5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(1000000,\"{:,}\",\"以逗号分隔的数字格式\")\\n,(0.25,\"{:.2%}\",\"百分比格式\")\\n,(1000000000,\"{:.2e}\",\"指数记法\")\\n,(13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\")\\n,(13,\"{:<10d}\",\"左对齐 (宽度为10)\")\\n,(13,\"{:^10d}\",\"中间对齐 (宽度为10)\")\\n,(11,\"{:b}\",\"二进制\")\\n,(11,\"{:d}\",\"十进制\")\\n,(11,\"{:o}\",\"八进制\")\\n,(11,\"{:x}\",\"十六进制\")\\n,(11,\"{:#x}\",\"十六进制\")\\n,(11,\"{:#X}\",\"十六进制\")\\n]', 'ls', 'for i in ls:\\n    print(\"原始数值:{value:10d},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:10d},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\".format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:10d},格式:{fmt:6},格式数值:{fmt:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2]))', 'for i in ls:\\n    print(\"原始数值:{value:10},格式:{fmt:6},格式数值:{fmt:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2]))', 'for i in ls:\\n    print(\"原始数值:{value:10},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:10d},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:10},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:20},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmt:20},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmt},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:15},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'ls=[(3.1415926,\"{:.2f}\",\"保留小数点后两位\")\\n,(3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(-1,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(2.71828,\"{:.0f}\",\"不带小数\")\\n,(5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\")\\n,(5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(1000000,\"{:,}\",\"以逗号分隔的数字格式\")\\n,(0.25,\"{:.2%}\",\"百分比格式\")\\n,(1000000000,\"{:.2e}\",\"指数记法\")\\n,(13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\")\\n,(13,\"{:<10d}\",\"左对齐 (宽度为10)\")\\n,(13,\"{:^10d}\",\"中间对齐 (宽度为10)\")\\n,(11,\"{:b}\",\"二进制\")\\n,(11,\"{:d}\",\"十进制\")\\n,(11,\"{:o}\",\"八进制\")\\n,(11,\"{:x}\",\"十六进制\")\\n,(11,\"{:#x}\",\"十六进制\")\\n,(11,\"{:#X}\",\"十六进制\")\\n]', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:15},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式描述:{disc},格式数值:{fmv:15}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:15},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '\"{}{{}}\".format(\"后面是一个大括号\")', 'print(frozenset())', 'print(frozenset(range(11)))', 'x=frozenset(range(11))', 'x', 'dir(x)', 'dir(list())', 'dir(list', 'dir(list)', 'dir(frozenset)', 'class Order():\\n    id=1', \"getattr(Order(),'id')\", \"getattr(Order(),'ids')\", \"getattr(Order(),'ids',None)\", 'getattr(Order(),\\'ids\\',\"None\")', 'print(globals())'], '_oh': {4: <class 'float'>, 6: 'quant trade', 7: 'quant trade', 8: 'trade quant', 9: 'trade quant quant', 11: 'quant trade', 12: 'trade quant quant', 14: '第一个参数是trade，第二个参数是quant', 15: '第一个参数是trade，第二个参数是quant,两个参数组合是：trade&quant', 17: 'class a', 22: [(3.1415926, '{:.2f}', '保留小数点后两位'), (3.1415926, '{:+.2f}', '带符号保留小数点后两位'), (-1, '{:+.2f}', '带符号保留小数点后两位'), (2.71828, '{:.0f}', '不带小数'), (5, '{:0>2d}', '数字补零 (填充左边, 宽度为2)'), (5, '{:x<4d}', '数字补x (填充右边, 宽度为4)'), (10, '{:x<4d}', '数字补x (填充右边, 宽度为4)'), (1000000, '{:,}', '以逗号分隔的数字格式'), (0.25, '{:.2%}', '百分比格式'), (1000000000, '{:.2e}', '指数记法'), (13, '{:10d}', '右对齐 (默认, 宽度为10)'), (13, '{:<10d}', '左对齐 (宽度为10)'), (13, '{:^10d}', '中间对齐 (宽度为10)'), (11, '{:b}', '二进制'), (11, '{:d}', '十进制'), (11, '{:o}', '八进制'), (11, '{:x}', '十六进制'), (11, '{:#x}', '十六进制'), (11, '{:#X}', '十六进制')], 39: '后面是一个大括号{}', 43: frozenset({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}), 44: ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'copy', 'difference', 'intersection', 'isdisjoint', 'issubset', 'issuperset', 'symmetric_difference', 'union'], 45: ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'], 47: ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'], 48: ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'copy', 'difference', 'intersection', 'isdisjoint', 'issubset', 'issuperset', 'symmetric_difference', 'union'], 50: 1, 53: 'None'}, '_dh': ['D:\\\\programdev\\\\python\\\\pythonlearn'], 'In': ['', 'print(float(1))', 'print(type(float(1)))', 'type(float(\"12,3\"))', 'type(float(\"12.3\"))', 'print(float(\"12.3\"))', '\"{} {}\".format(\\'quant\\',\\'trade\\')', '\"{0} {1}\".format(\\'quant\\',\\'trade\\')', '\"{1} {0}\".format(\\'quant\\',\\'trade\\')', '\"{1} {0} {0}\".format(\\'quant\\',\\'trade\\')', '\"{} {} {}\".format(\\'quant\\',\\'trade\\') # 不设置指定位置，按照默认顺序调用', '\"{} {}\".format(\\'quant\\',\\'trade\\') # 不设置指定位置，按照默认顺序调用', '\"{1} {0} {0}\".format(\\'quant\\',\\'trade\\')# 设置指定位置', '# 设置参数\\n\"第一个参数是{first}，第二个参数是{second}\".format(secont=\\'quant\\',first=\\'trade\\')', '# 设置参数\\n\"第一个参数是{first}，第二个参数是{second}\".format(second=\\'quant\\',first=\\'trade\\')', '# 设置参数\\n\"第一个参数是{first}，第二个参数是{second},两个参数组合是：{first}&{second}\".format(second=\\'quant\\',first=\\'trade\\')', \"class A():\\n    name='class a'\", '\"{a.name}\".format(a=A())', 'ls=[3.1415926,\"{:.2f}\",\"保留小数点后两位\"\\n3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\"\\n-1,\"{:+.2f}\",\"带符号保留小数点后两位\"\\n2.71828,\"{:.0f}\",\"不带小数\"\\n5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\"\\n5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\"\\n10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\"\\n1000000,\"{:,}\",\"以逗号分隔的数字格式\"\\n0.25,\"{:.2%}\",\"百分比格式\"\\n1000000000,\"{:.2e}\",\"指数记法\"\\n13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\"\\n13,\"{:<10d}\",\"左对齐 (宽度为10)\"\\n13,\"{:^10d}\",\"中间对齐 (宽度为10)\"\\n11,\"{:b}\",\"二进制\"\\n11,\"{:d}\",\"十进制\"\\n11,\"{:o}\",\"八进制\"\\n11,\"{:x}\",\"十六进制\"\\n11,\"{:#x}\",\"十六进制\"\\n11,\"{:#X}\",\"十六进制\"]', 'ls=[(3.1415926,\"{:.2f}\",\"保留小数点后两位\")\\n(3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n(-1,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n(2.71828,\"{:.0f}\",\"不带小数\")\\n(5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\")\\n(5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n(10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n(1000000,\"{:,}\",\"以逗号分隔的数字格式\")\\n(0.25,\"{:.2%}\",\"百分比格式\")\\n(1000000000,\"{:.2e}\",\"指数记法\")\\n(13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\")\\n(13,\"{:<10d}\",\"左对齐 (宽度为10)\")\\n(13,\"{:^10d}\",\"中间对齐 (宽度为10)\")\\n(11,\"{:b}\",\"二进制\")\\n(11,\"{:d}\",\"十进制\")\\n(11,\"{:o}\",\"八进制\")\\n(11,\"{:x}\",\"十六进制\")\\n(11,\"{:#x}\",\"十六进制\")\\n(11,\"{:#X}\",\"十六进制\")\\n]', 'ls=[(3.1415926,\"{:.2f}\",\"保留小数点后两位\")\\n,(3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(-1,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(2.71828,\"{:.0f}\",\"不带小数\")\\n,(5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\")\\n,(5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(1000000,\"{:,}\",\"以逗号分隔的数字格式\")\\n,(0.25,\"{:.2%}\",\"百分比格式\")\\n,(1000000000,\"{:.2e}\",\"指数记法\")\\n,(13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\")\\n,(13,\"{:<10d}\",\"左对齐 (宽度为10)\")\\n,(13,\"{:^10d}\",\"中间对齐 (宽度为10)\")\\n,(11,\"{:b}\",\"二进制\")\\n,(11,\"{:d}\",\"十进制\")\\n,(11,\"{:o}\",\"八进制\")\\n,(11,\"{:x}\",\"十六进制\")\\n,(11,\"{:#x}\",\"十六进制\")\\n,(11,\"{:#X}\",\"十六进制\")\\n]', 'ls=[(3.1415926,\"{:.2f}\",\"保留小数点后两位\")\\n,(3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(-1,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(2.71828,\"{:.0f}\",\"不带小数\")\\n,(5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\")\\n,(5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(1000000,\"{:,}\",\"以逗号分隔的数字格式\")\\n,(0.25,\"{:.2%}\",\"百分比格式\")\\n,(1000000000,\"{:.2e}\",\"指数记法\")\\n,(13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\")\\n,(13,\"{:<10d}\",\"左对齐 (宽度为10)\")\\n,(13,\"{:^10d}\",\"中间对齐 (宽度为10)\")\\n,(11,\"{:b}\",\"二进制\")\\n,(11,\"{:d}\",\"十进制\")\\n,(11,\"{:o}\",\"八进制\")\\n,(11,\"{:x}\",\"十六进制\")\\n,(11,\"{:#x}\",\"十六进制\")\\n,(11,\"{:#X}\",\"十六进制\")\\n]', 'ls', 'for i in ls:\\n    print(\"原始数值:{value:10d},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:10d},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\".format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:10d},格式:{fmt:6},格式数值:{fmt:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2]))', 'for i in ls:\\n    print(\"原始数值:{value:10},格式:{fmt:6},格式数值:{fmt:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2]))', 'for i in ls:\\n    print(\"原始数值:{value:10},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:10d},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:10},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:20},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmt:20},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmt},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:15},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'ls=[(3.1415926,\"{:.2f}\",\"保留小数点后两位\")\\n,(3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(-1,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(2.71828,\"{:.0f}\",\"不带小数\")\\n,(5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\")\\n,(5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(1000000,\"{:,}\",\"以逗号分隔的数字格式\")\\n,(0.25,\"{:.2%}\",\"百分比格式\")\\n,(1000000000,\"{:.2e}\",\"指数记法\")\\n,(13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\")\\n,(13,\"{:<10d}\",\"左对齐 (宽度为10)\")\\n,(13,\"{:^10d}\",\"中间对齐 (宽度为10)\")\\n,(11,\"{:b}\",\"二进制\")\\n,(11,\"{:d}\",\"十进制\")\\n,(11,\"{:o}\",\"八进制\")\\n,(11,\"{:x}\",\"十六进制\")\\n,(11,\"{:#x}\",\"十六进制\")\\n,(11,\"{:#X}\",\"十六进制\")\\n]', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:15},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式描述:{disc},格式数值:{fmv:15}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:15},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '\"{}{{}}\".format(\"后面是一个大括号\")', 'print(frozenset())', 'print(frozenset(range(11)))', 'x=frozenset(range(11))', 'x', 'dir(x)', 'dir(list())', 'dir(list', 'dir(list)', 'dir(frozenset)', 'class Order():\\n    id=1', \"getattr(Order(),'id')\", \"getattr(Order(),'ids')\", \"getattr(Order(),'ids',None)\", 'getattr(Order(),\\'ids\\',\"None\")', 'print(globals())'], 'Out': {4: <class 'float'>, 6: 'quant trade', 7: 'quant trade', 8: 'trade quant', 9: 'trade quant quant', 11: 'quant trade', 12: 'trade quant quant', 14: '第一个参数是trade，第二个参数是quant', 15: '第一个参数是trade，第二个参数是quant,两个参数组合是：trade&quant', 17: 'class a', 22: [(3.1415926, '{:.2f}', '保留小数点后两位'), (3.1415926, '{:+.2f}', '带符号保留小数点后两位'), (-1, '{:+.2f}', '带符号保留小数点后两位'), (2.71828, '{:.0f}', '不带小数'), (5, '{:0>2d}', '数字补零 (填充左边, 宽度为2)'), (5, '{:x<4d}', '数字补x (填充右边, 宽度为4)'), (10, '{:x<4d}', '数字补x (填充右边, 宽度为4)'), (1000000, '{:,}', '以逗号分隔的数字格式'), (0.25, '{:.2%}', '百分比格式'), (1000000000, '{:.2e}', '指数记法'), (13, '{:10d}', '右对齐 (默认, 宽度为10)'), (13, '{:<10d}', '左对齐 (宽度为10)'), (13, '{:^10d}', '中间对齐 (宽度为10)'), (11, '{:b}', '二进制'), (11, '{:d}', '十进制'), (11, '{:o}', '八进制'), (11, '{:x}', '十六进制'), (11, '{:#x}', '十六进制'), (11, '{:#X}', '十六进制')], 39: '后面是一个大括号{}', 43: frozenset({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}), 44: ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'copy', 'difference', 'intersection', 'isdisjoint', 'issubset', 'issuperset', 'symmetric_difference', 'union'], 45: ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'], 47: ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'], 48: ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'copy', 'difference', 'intersection', 'isdisjoint', 'issubset', 'issuperset', 'symmetric_difference', 'union'], 50: 1, 53: 'None'}, 'get_ipython': <bound method InteractiveShell.get_ipython of <ipykernel.zmqshell.ZMQInteractiveShell object at 0x000001DCF64AD320>>, 'exit': <IPython.core.autocall.ZMQExitAutocall object at 0x000001DCF6604A90>, 'quit': <IPython.core.autocall.ZMQExitAutocall object at 0x000001DCF6604A90>, '_': 'None', '__': 1, '___': ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'copy', 'difference', 'intersection', 'isdisjoint', 'issubset', 'issuperset', 'symmetric_difference', 'union'], '_i': 'getattr(Order(),\\'ids\\',\"None\")', '_ii': \"getattr(Order(),'ids',None)\", '_iii': \"getattr(Order(),'ids')\", '_i1': 'print(float(1))', '_i2': 'print(type(float(1)))', '_i3': 'type(float(\"12,3\"))', '_i4': 'type(float(\"12.3\"))', '_4': <class 'float'>, '_i5': 'print(float(\"12.3\"))', '_i6': '\"{} {}\".format(\\'quant\\',\\'trade\\')', '_6': 'quant trade', '_i7': '\"{0} {1}\".format(\\'quant\\',\\'trade\\')', '_7': 'quant trade', '_i8': '\"{1} {0}\".format(\\'quant\\',\\'trade\\')', '_8': 'trade quant', '_i9': '\"{1} {0} {0}\".format(\\'quant\\',\\'trade\\')', '_9': 'trade quant quant', '_i10': '\"{} {} {}\".format(\\'quant\\',\\'trade\\') # 不设置指定位置，按照默认顺序调用', '_i11': '\"{} {}\".format(\\'quant\\',\\'trade\\') # 不设置指定位置，按照默认顺序调用', '_11': 'quant trade', '_i12': '\"{1} {0} {0}\".format(\\'quant\\',\\'trade\\')# 设置指定位置', '_12': 'trade quant quant', '_i13': '# 设置参数\\n\"第一个参数是{first}，第二个参数是{second}\".format(secont=\\'quant\\',first=\\'trade\\')', '_i14': '# 设置参数\\n\"第一个参数是{first}，第二个参数是{second}\".format(second=\\'quant\\',first=\\'trade\\')', '_14': '第一个参数是trade，第二个参数是quant', '_i15': '# 设置参数\\n\"第一个参数是{first}，第二个参数是{second},两个参数组合是：{first}&{second}\".format(second=\\'quant\\',first=\\'trade\\')', '_15': '第一个参数是trade，第二个参数是quant,两个参数组合是：trade&quant', '_i16': \"class A():\\n    name='class a'\", 'A': <class '__main__.A'>, '_i17': '\"{a.name}\".format(a=A())', '_17': 'class a', '_i18': 'ls=[3.1415926,\"{:.2f}\",\"保留小数点后两位\"\\n3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\"\\n-1,\"{:+.2f}\",\"带符号保留小数点后两位\"\\n2.71828,\"{:.0f}\",\"不带小数\"\\n5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\"\\n5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\"\\n10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\"\\n1000000,\"{:,}\",\"以逗号分隔的数字格式\"\\n0.25,\"{:.2%}\",\"百分比格式\"\\n1000000000,\"{:.2e}\",\"指数记法\"\\n13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\"\\n13,\"{:<10d}\",\"左对齐 (宽度为10)\"\\n13,\"{:^10d}\",\"中间对齐 (宽度为10)\"\\n11,\"{:b}\",\"二进制\"\\n11,\"{:d}\",\"十进制\"\\n11,\"{:o}\",\"八进制\"\\n11,\"{:x}\",\"十六进制\"\\n11,\"{:#x}\",\"十六进制\"\\n11,\"{:#X}\",\"十六进制\"]', '_i19': 'ls=[(3.1415926,\"{:.2f}\",\"保留小数点后两位\")\\n(3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n(-1,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n(2.71828,\"{:.0f}\",\"不带小数\")\\n(5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\")\\n(5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n(10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n(1000000,\"{:,}\",\"以逗号分隔的数字格式\")\\n(0.25,\"{:.2%}\",\"百分比格式\")\\n(1000000000,\"{:.2e}\",\"指数记法\")\\n(13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\")\\n(13,\"{:<10d}\",\"左对齐 (宽度为10)\")\\n(13,\"{:^10d}\",\"中间对齐 (宽度为10)\")\\n(11,\"{:b}\",\"二进制\")\\n(11,\"{:d}\",\"十进制\")\\n(11,\"{:o}\",\"八进制\")\\n(11,\"{:x}\",\"十六进制\")\\n(11,\"{:#x}\",\"十六进制\")\\n(11,\"{:#X}\",\"十六进制\")\\n]', '_i20': 'ls=[(3.1415926,\"{:.2f}\",\"保留小数点后两位\")\\n,(3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(-1,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(2.71828,\"{:.0f}\",\"不带小数\")\\n,(5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\")\\n,(5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(1000000,\"{:,}\",\"以逗号分隔的数字格式\")\\n,(0.25,\"{:.2%}\",\"百分比格式\")\\n,(1000000000,\"{:.2e}\",\"指数记法\")\\n,(13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\")\\n,(13,\"{:<10d}\",\"左对齐 (宽度为10)\")\\n,(13,\"{:^10d}\",\"中间对齐 (宽度为10)\")\\n,(11,\"{:b}\",\"二进制\")\\n,(11,\"{:d}\",\"十进制\")\\n,(11,\"{:o}\",\"八进制\")\\n,(11,\"{:x}\",\"十六进制\")\\n,(11,\"{:#x}\",\"十六进制\")\\n,(11,\"{:#X}\",\"十六进制\")\\n]', 'ls': [(3.1415926, '{:.2f}', '保留小数点后两位'), (3.1415926, '{:+.2f}', '带符号保留小数点后两位'), (-1, '{:+.2f}', '带符号保留小数点后两位'), (2.71828, '{:.0f}', '不带小数'), (5, '{:0>2d}', '数字补零 (填充左边, 宽度为2)'), (5, '{:x<4d}', '数字补x (填充右边, 宽度为4)'), (10, '{:x<4d}', '数字补x (填充右边, 宽度为4)'), (1000000, '{:,}', '以逗号分隔的数字格式'), (0.25, '{:.2%}', '百分比格式'), (1000000000, '{:.2e}', '指数记法'), (13, '{:10d}', '右对齐 (默认, 宽度为10)'), (13, '{:<10d}', '左对齐 (宽度为10)'), (13, '{:^10d}', '中间对齐 (宽度为10)'), (11, '{:b}', '二进制'), (11, '{:d}', '十进制'), (11, '{:o}', '八进制'), (11, '{:x}', '十六进制'), (11, '{:#x}', '十六进制'), (11, '{:#X}', '十六进制')], '_i21': 'ls=[(3.1415926,\"{:.2f}\",\"保留小数点后两位\")\\n,(3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(-1,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(2.71828,\"{:.0f}\",\"不带小数\")\\n,(5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\")\\n,(5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(1000000,\"{:,}\",\"以逗号分隔的数字格式\")\\n,(0.25,\"{:.2%}\",\"百分比格式\")\\n,(1000000000,\"{:.2e}\",\"指数记法\")\\n,(13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\")\\n,(13,\"{:<10d}\",\"左对齐 (宽度为10)\")\\n,(13,\"{:^10d}\",\"中间对齐 (宽度为10)\")\\n,(11,\"{:b}\",\"二进制\")\\n,(11,\"{:d}\",\"十进制\")\\n,(11,\"{:o}\",\"八进制\")\\n,(11,\"{:x}\",\"十六进制\")\\n,(11,\"{:#x}\",\"十六进制\")\\n,(11,\"{:#X}\",\"十六进制\")\\n]', '_i22': 'ls', '_22': [(3.1415926, '{:.2f}', '保留小数点后两位'), (3.1415926, '{:+.2f}', '带符号保留小数点后两位'), (-1, '{:+.2f}', '带符号保留小数点后两位'), (2.71828, '{:.0f}', '不带小数'), (5, '{:0>2d}', '数字补零 (填充左边, 宽度为2)'), (5, '{:x<4d}', '数字补x (填充右边, 宽度为4)'), (10, '{:x<4d}', '数字补x (填充右边, 宽度为4)'), (1000000, '{:,}', '以逗号分隔的数字格式'), (0.25, '{:.2%}', '百分比格式'), (1000000000, '{:.2e}', '指数记法'), (13, '{:10d}', '右对齐 (默认, 宽度为10)'), (13, '{:<10d}', '左对齐 (宽度为10)'), (13, '{:^10d}', '中间对齐 (宽度为10)'), (11, '{:b}', '二进制'), (11, '{:d}', '十进制'), (11, '{:o}', '八进制'), (11, '{:x}', '十六进制'), (11, '{:#x}', '十六进制'), (11, '{:#X}', '十六进制')], '_i23': 'for i in ls:\\n    print(\"原始数值:{value:10d},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', 'i': (11, '{:#X}', '十六进制'), '_i24': 'for i in ls:\\n    print(\"原始数值:{value:10d},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\".format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '_i25': 'for i in ls:\\n    print(\"原始数值:{value:10d},格式:{fmt:6},格式数值:{fmt:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2]))', '_i26': 'for i in ls:\\n    print(\"原始数值:{value:10},格式:{fmt:6},格式数值:{fmt:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2]))', '_i27': 'for i in ls:\\n    print(\"原始数值:{value:10},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '_i28': 'for i in ls:\\n    print(\"原始数值:{value:10d},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '_i29': 'for i in ls:\\n    print(\"原始数值:{value:10},格式:{fmt:6},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '_i30': 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:20},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '_i31': 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmt:20},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '_i32': 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmt},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '_i33': 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:10},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '_i34': 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:15},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '_i35': 'ls=[(3.1415926,\"{:.2f}\",\"保留小数点后两位\")\\n,(3.1415926,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(-1,\"{:+.2f}\",\"带符号保留小数点后两位\")\\n,(2.71828,\"{:.0f}\",\"不带小数\")\\n,(5,\"{:0>2d}\",\"数字补零 (填充左边, 宽度为2)\")\\n,(5,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(10,\"{:x<4d}\",\"数字补x (填充右边, 宽度为4)\")\\n,(1000000,\"{:,}\",\"以逗号分隔的数字格式\")\\n,(0.25,\"{:.2%}\",\"百分比格式\")\\n,(1000000000,\"{:.2e}\",\"指数记法\")\\n,(13,\"{:10d}\",\"右对齐 (默认, 宽度为10)\")\\n,(13,\"{:<10d}\",\"左对齐 (宽度为10)\")\\n,(13,\"{:^10d}\",\"中间对齐 (宽度为10)\")\\n,(11,\"{:b}\",\"二进制\")\\n,(11,\"{:d}\",\"十进制\")\\n,(11,\"{:o}\",\"八进制\")\\n,(11,\"{:x}\",\"十六进制\")\\n,(11,\"{:#x}\",\"十六进制\")\\n,(11,\"{:#X}\",\"十六进制\")\\n]', '_i36': 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:15},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '_i37': 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式描述:{disc},格式数值:{fmv:15}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '_i38': 'for i in ls:\\n    print(\"原始数值:{value:12},格式:{fmt:10},格式数值:{fmv:15},格式描述:{disc}\"\\n          .format(value=i[0],fmt=i[1],disc=i[2],fmv=i[1].format(i[0])))', '_i39': '\"{}{{}}\".format(\"后面是一个大括号\")', '_39': '后面是一个大括号{}', '_i40': 'print(frozenset())', '_i41': 'print(frozenset(range(11)))', '_i42': 'x=frozenset(range(11))', 'x': frozenset({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}), '_i43': 'x', '_43': frozenset({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}), '_i44': 'dir(x)', '_44': ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'copy', 'difference', 'intersection', 'isdisjoint', 'issubset', 'issuperset', 'symmetric_difference', 'union'], '_i45': 'dir(list())', '_45': ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'], '_i46': 'dir(list', '_i47': 'dir(list)', '_47': ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'], '_i48': 'dir(frozenset)', '_48': ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'copy', 'difference', 'intersection', 'isdisjoint', 'issubset', 'issuperset', 'symmetric_difference', 'union'], '_i49': 'class Order():\\n    id=1', 'Order': <class '__main__.Order'>, '_i50': \"getattr(Order(),'id')\", '_50': 1, '_i51': \"getattr(Order(),'ids')\", '_i52': \"getattr(Order(),'ids',None)\", '_i53': 'getattr(Order(),\\'ids\\',\"None\")', '_53': 'None', '_i54': 'print(globals())'}\n"
     ]
    }
   ],
   "source": [
    "print(globals())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# hasattr\n",
    "hasattr() 函数用于判断对象是否包含对应的属性。<br>\n",
    "语法：\n",
    "```python\n",
    "hasattr(object, name)\n",
    "```\n",
    "object -- 对象。<br>\n",
    "name -- 字符串，对象属性。<br>\n",
    "如果对象有该属性返回 True，否则返回 False。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hasattr(Order(),'ids')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# hash\n",
    "hash() 用于获取取一个对象（字符串或者数值等）的哈希值。<br>\n",
    "语法：\n",
    "```python\n",
    "hash(object)\n",
    "```\n",
    "object -- 对象。<br>\n",
    "返回对象的哈希值。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-4131956993970063046"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hash(\"hello\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# help\n",
    "help() 函数用于查看函数或模块用途的详细说明。<br>\n",
    "语法：\n",
    "```python\n",
    "help([object])\n",
    "```\n",
    "object -- 对象。<br>\n",
    "返回对象帮助信息。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in module sys:\n",
      "\n",
      "NAME\n",
      "    sys\n",
      "\n",
      "MODULE REFERENCE\n",
      "    https://docs.python.org/3.6/library/sys\n",
      "    \n",
      "    The following documentation is automatically generated from the Python\n",
      "    source files.  It may be incomplete, incorrect or include features that\n",
      "    are considered implementation detail and may vary between Python\n",
      "    implementations.  When in doubt, consult the module reference at the\n",
      "    location listed above.\n",
      "\n",
      "DESCRIPTION\n",
      "    This module provides access to some objects used or maintained by the\n",
      "    interpreter and to functions that interact strongly with the interpreter.\n",
      "    \n",
      "    Dynamic objects:\n",
      "    \n",
      "    argv -- command line arguments; argv[0] is the script pathname if known\n",
      "    path -- module search path; path[0] is the script directory, else ''\n",
      "    modules -- dictionary of loaded modules\n",
      "    \n",
      "    displayhook -- called to show results in an interactive session\n",
      "    excepthook -- called to handle any uncaught exception other than SystemExit\n",
      "      To customize printing in an interactive session or to install a custom\n",
      "      top-level exception handler, assign other functions to replace these.\n",
      "    \n",
      "    stdin -- standard input file object; used by input()\n",
      "    stdout -- standard output file object; used by print()\n",
      "    stderr -- standard error object; used for error messages\n",
      "      By assigning other file objects (or objects that behave like files)\n",
      "      to these, it is possible to redirect all of the interpreter's I/O.\n",
      "    \n",
      "    last_type -- type of last uncaught exception\n",
      "    last_value -- value of last uncaught exception\n",
      "    last_traceback -- traceback of last uncaught exception\n",
      "      These three are only available in an interactive session after a\n",
      "      traceback has been printed.\n",
      "    \n",
      "    Static objects:\n",
      "    \n",
      "    builtin_module_names -- tuple of module names built into this interpreter\n",
      "    copyright -- copyright notice pertaining to this interpreter\n",
      "    exec_prefix -- prefix used to find the machine-specific Python library\n",
      "    executable -- absolute path of the executable binary of the Python interpreter\n",
      "    float_info -- a struct sequence with information about the float implementation.\n",
      "    float_repr_style -- string indicating the style of repr() output for floats\n",
      "    hash_info -- a struct sequence with information about the hash algorithm.\n",
      "    hexversion -- version information encoded as a single integer\n",
      "    implementation -- Python implementation information.\n",
      "    int_info -- a struct sequence with information about the int implementation.\n",
      "    maxsize -- the largest supported length of containers.\n",
      "    maxunicode -- the value of the largest Unicode code point\n",
      "    platform -- platform identifier\n",
      "    prefix -- prefix used to find the Python library\n",
      "    thread_info -- a struct sequence with information about the thread implementation.\n",
      "    version -- the version of this interpreter as a string\n",
      "    version_info -- version information as a named tuple\n",
      "    dllhandle -- [Windows only] integer handle of the Python DLL\n",
      "    winver -- [Windows only] version number of the Python DLL\n",
      "    _enablelegacywindowsfsencoding -- [Windows only] \n",
      "    __stdin__ -- the original stdin; don't touch!\n",
      "    __stdout__ -- the original stdout; don't touch!\n",
      "    __stderr__ -- the original stderr; don't touch!\n",
      "    __displayhook__ -- the original displayhook; don't touch!\n",
      "    __excepthook__ -- the original excepthook; don't touch!\n",
      "    \n",
      "    Functions:\n",
      "    \n",
      "    displayhook() -- print an object to the screen, and save it in builtins._\n",
      "    excepthook() -- print an exception and its traceback to sys.stderr\n",
      "    exc_info() -- return thread-safe information about the current exception\n",
      "    exit() -- exit the interpreter by raising SystemExit\n",
      "    getdlopenflags() -- returns flags to be used for dlopen() calls\n",
      "    getprofile() -- get the global profiling function\n",
      "    getrefcount() -- return the reference count for an object (plus one :-)\n",
      "    getrecursionlimit() -- return the max recursion depth for the interpreter\n",
      "    getsizeof() -- return the size of an object in bytes\n",
      "    gettrace() -- get the global debug tracing function\n",
      "    setcheckinterval() -- control how often the interpreter checks for events\n",
      "    setdlopenflags() -- set the flags to be used for dlopen() calls\n",
      "    setprofile() -- set the global profiling function\n",
      "    setrecursionlimit() -- set the max recursion depth for the interpreter\n",
      "    settrace() -- set the global debug tracing function\n",
      "\n",
      "FUNCTIONS\n",
      "    __displayhook__ = displayhook(...)\n",
      "        displayhook(object) -> None\n",
      "        \n",
      "        Print an object to sys.stdout and also save it in builtins._\n",
      "    \n",
      "    __excepthook__ = excepthook(...)\n",
      "        excepthook(exctype, value, traceback) -> None\n",
      "        \n",
      "        Handle an exception by displaying it with a traceback on sys.stderr.\n",
      "    \n",
      "    call_tracing(...)\n",
      "        call_tracing(func, args) -> object\n",
      "        \n",
      "        Call func(*args), while tracing is enabled.  The tracing state is\n",
      "        saved, and restored afterwards.  This is intended to be called from\n",
      "        a debugger from a checkpoint, to recursively debug some other code.\n",
      "    \n",
      "    callstats(...)\n",
      "        callstats() -> tuple of integers\n",
      "        \n",
      "        Return a tuple of function call statistics, if CALL_PROFILE was defined\n",
      "        when Python was built.  Otherwise, return None.\n",
      "        \n",
      "        When enabled, this function returns detailed, implementation-specific\n",
      "        details about the number of function calls executed. The return value is\n",
      "        a 11-tuple where the entries in the tuple are counts of:\n",
      "        0. all function calls\n",
      "        1. calls to PyFunction_Type objects\n",
      "        2. PyFunction calls that do not create an argument tuple\n",
      "        3. PyFunction calls that do not create an argument tuple\n",
      "           and bypass PyEval_EvalCodeEx()\n",
      "        4. PyMethod calls\n",
      "        5. PyMethod calls on bound methods\n",
      "        6. PyType calls\n",
      "        7. PyCFunction calls\n",
      "        8. generator calls\n",
      "        9. All other calls\n",
      "        10. Number of stack pops performed by call_function()\n",
      "    \n",
      "    exc_info(...)\n",
      "        exc_info() -> (type, value, traceback)\n",
      "        \n",
      "        Return information about the most recent exception caught by an except\n",
      "        clause in the current stack frame or in an older stack frame.\n",
      "    \n",
      "    exit(...)\n",
      "        exit([status])\n",
      "        \n",
      "        Exit the interpreter by raising SystemExit(status).\n",
      "        If the status is omitted or None, it defaults to zero (i.e., success).\n",
      "        If the status is an integer, it will be used as the system exit status.\n",
      "        If it is another kind of object, it will be printed and the system\n",
      "        exit status will be one (i.e., failure).\n",
      "    \n",
      "    get_asyncgen_hooks(...)\n",
      "        get_asyncgen_hooks()\n",
      "        \n",
      "        Return a namedtuple of installed asynchronous generators hooks (firstiter, finalizer).\n",
      "    \n",
      "    get_coroutine_wrapper(...)\n",
      "        get_coroutine_wrapper()\n",
      "        \n",
      "        Return the wrapper for coroutine objects set by sys.set_coroutine_wrapper.\n",
      "    \n",
      "    getallocatedblocks(...)\n",
      "        getallocatedblocks() -> integer\n",
      "        \n",
      "        Return the number of memory blocks currently allocated, regardless of their\n",
      "        size.\n",
      "    \n",
      "    getcheckinterval(...)\n",
      "        getcheckinterval() -> current check interval; see setcheckinterval().\n",
      "    \n",
      "    getdefaultencoding(...)\n",
      "        getdefaultencoding() -> string\n",
      "        \n",
      "        Return the current default string encoding used by the Unicode \n",
      "        implementation.\n",
      "    \n",
      "    getfilesystemencodeerrors(...)\n",
      "        getfilesystemencodeerrors() -> string\n",
      "        \n",
      "        Return the error mode used to convert Unicode filenames in\n",
      "        operating system filenames.\n",
      "    \n",
      "    getfilesystemencoding(...)\n",
      "        getfilesystemencoding() -> string\n",
      "        \n",
      "        Return the encoding used to convert Unicode filenames in\n",
      "        operating system filenames.\n",
      "    \n",
      "    getprofile(...)\n",
      "        getprofile()\n",
      "        \n",
      "        Return the profiling function set with sys.setprofile.\n",
      "        See the profiler chapter in the library manual.\n",
      "    \n",
      "    getrecursionlimit(...)\n",
      "        getrecursionlimit()\n",
      "        \n",
      "        Return the current value of the recursion limit, the maximum depth\n",
      "        of the Python interpreter stack.  This limit prevents infinite\n",
      "        recursion from causing an overflow of the C stack and crashing Python.\n",
      "    \n",
      "    getrefcount(...)\n",
      "        getrefcount(object) -> integer\n",
      "        \n",
      "        Return the reference count of object.  The count returned is generally\n",
      "        one higher than you might expect, because it includes the (temporary)\n",
      "        reference as an argument to getrefcount().\n",
      "    \n",
      "    getsizeof(...)\n",
      "        getsizeof(object, default) -> int\n",
      "        \n",
      "        Return the size of object in bytes.\n",
      "    \n",
      "    getswitchinterval(...)\n",
      "        getswitchinterval() -> current thread switch interval; see setswitchinterval().\n",
      "    \n",
      "    gettrace(...)\n",
      "        gettrace()\n",
      "        \n",
      "        Return the global debug tracing function set with sys.settrace.\n",
      "        See the debugger chapter in the library manual.\n",
      "    \n",
      "    getwindowsversion(...)\n",
      "        getwindowsversion()\n",
      "        \n",
      "        Return information about the running version of Windows as a named tuple.\n",
      "        The members are named: major, minor, build, platform, service_pack,\n",
      "        service_pack_major, service_pack_minor, suite_mask, and product_type. For\n",
      "        backward compatibility, only the first 5 items are available by indexing.\n",
      "        All elements are numbers, except service_pack and platform_type which are\n",
      "        strings, and platform_version which is a 3-tuple. Platform is always 2.\n",
      "        Product_type may be 1 for a workstation, 2 for a domain controller, 3 for a\n",
      "        server. Platform_version is a 3-tuple containing a version number that is\n",
      "        intended for identifying the OS rather than feature detection.\n",
      "    \n",
      "    intern(...)\n",
      "        intern(string) -> string\n",
      "        \n",
      "        ``Intern'' the given string.  This enters the string in the (global)\n",
      "        table of interned strings whose purpose is to speed up dictionary lookups.\n",
      "        Return the string itself or the previously interned string object with the\n",
      "        same value.\n",
      "    \n",
      "    is_finalizing(...)\n",
      "        is_finalizing()\n",
      "        Return True if Python is exiting.\n",
      "    \n",
      "    set_asyncgen_hooks(...)\n",
      "        set_asyncgen_hooks(*, firstiter=None, finalizer=None)\n",
      "        \n",
      "        Set a finalizer for async generators objects.\n",
      "    \n",
      "    set_coroutine_wrapper(...)\n",
      "        set_coroutine_wrapper(wrapper)\n",
      "        \n",
      "        Set a wrapper for coroutine objects.\n",
      "    \n",
      "    setcheckinterval(...)\n",
      "        setcheckinterval(n)\n",
      "        \n",
      "        Tell the Python interpreter to check for asynchronous events every\n",
      "        n instructions.  This also affects how often thread switches occur.\n",
      "    \n",
      "    setprofile(...)\n",
      "        setprofile(function)\n",
      "        \n",
      "        Set the profiling function.  It will be called on each function call\n",
      "        and return.  See the profiler chapter in the library manual.\n",
      "    \n",
      "    setrecursionlimit(...)\n",
      "        setrecursionlimit(n)\n",
      "        \n",
      "        Set the maximum depth of the Python interpreter stack to n.  This\n",
      "        limit prevents infinite recursion from causing an overflow of the C\n",
      "        stack and crashing Python.  The highest possible limit is platform-\n",
      "        dependent.\n",
      "    \n",
      "    setswitchinterval(...)\n",
      "        setswitchinterval(n)\n",
      "        \n",
      "        Set the ideal thread switching delay inside the Python interpreter\n",
      "        The actual frequency of switching threads can be lower if the\n",
      "        interpreter executes long sequences of uninterruptible code\n",
      "        (this is implementation-specific and workload-dependent).\n",
      "        \n",
      "        The parameter must represent the desired switching delay in seconds\n",
      "        A typical value is 0.005 (5 milliseconds).\n",
      "    \n",
      "    settrace(...)\n",
      "        settrace(function)\n",
      "        \n",
      "        Set the global debug tracing function.  It will be called on each\n",
      "        function call.  See the debugger chapter in the library manual.\n",
      "\n",
      "DATA\n",
      "    __stderr__ = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf...\n",
      "    __stdin__ = <_io.TextIOWrapper name='<stdin>' mode='r' encoding='cp936...\n",
      "    __stdout__ = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf...\n",
      "    api_version = 1013\n",
      "    argv = [r'd:\\env\\pythonve\\test36\\lib\\site-packages\\ipykernel_launcher....\n",
      "    base_exec_prefix = r'C:\\Program Files\\Python36'\n",
      "    base_prefix = r'C:\\Program Files\\Python36'\n",
      "    builtin_module_names = ('_ast', '_bisect', '_blake2', '_codecs', '_cod...\n",
      "    byteorder = 'little'\n",
      "    copyright = 'Copyright (c) 2001-2018 Python Software Foundati...ematis...\n",
      "    displayhook = <ipykernel.displayhook.ZMQShellDisplayHook object>\n",
      "    dllhandle = 1668612096\n",
      "    dont_write_bytecode = False\n",
      "    exec_prefix = r'd:\\env\\pythonve\\test36'\n",
      "    executable = r'd:\\env\\pythonve\\test36\\scripts\\python.exe'\n",
      "    flags = sys.flags(debug=0, inspect=0, interactive=0, opt...ing=0, quie...\n",
      "    float_info = sys.float_info(max=1.7976931348623157e+308, max_...epsilo...\n",
      "    float_repr_style = 'short'\n",
      "    hash_info = sys.hash_info(width=64, modulus=2305843009213693...iphash2...\n",
      "    hexversion = 50726384\n",
      "    implementation = namespace(cache_tag='cpython-36', hexversion=507...in...\n",
      "    int_info = sys.int_info(bits_per_digit=30, sizeof_digit=4)\n",
      "    last_value = NameError(\"name 'sys' is not defined\",)\n",
      "    maxsize = 9223372036854775807\n",
      "    maxunicode = 1114111\n",
      "    meta_path = [<class '_frozen_importlib.BuiltinImporter'>, <class '_fro...\n",
      "    modules = {'IPython': <module 'IPython' from 'd:\\\\env\\\\pythonve\\\\test3...\n",
      "    path = ['', r'd:\\env\\pythonve\\test36\\scripts\\python36.zip', r'C:\\Progr...\n",
      "    path_hooks = [<class 'zipimport.zipimporter'>, <function FileFinder.pa...\n",
      "    path_importer_cache = {r'C:\\Program Files\\Python36': FileFinder('C:\\\\P...\n",
      "    platform = 'win32'\n",
      "    prefix = r'd:\\env\\pythonve\\test36'\n",
      "    ps1 = 'In : '\n",
      "    ps2 = '...: '\n",
      "    ps3 = 'Out: '\n",
      "    stderr = <ipykernel.iostream.OutStream object>\n",
      "    stdin = <_io.TextIOWrapper name='<stdin>' mode='r' encoding='cp936'>\n",
      "    stdout = <ipykernel.iostream.OutStream object>\n",
      "    thread_info = sys.thread_info(name='nt', lock=None, version=None)\n",
      "    version = '3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.190...\n",
      "    version_info = sys.version_info(major=3, minor=6, micro=5, releaseleve...\n",
      "    warnoptions = []\n",
      "    winver = '3.6'\n",
      "\n",
      "FILE\n",
      "    (built-in)\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "help(sys)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on class Order in module __main__:\n",
      "\n",
      "class Order(builtins.object)\n",
      " |  Data descriptors defined here:\n",
      " |  \n",
      " |  __dict__\n",
      " |      dictionary for instance variables (if defined)\n",
      " |  \n",
      " |  __weakref__\n",
      " |      list of weak references to the object (if defined)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes defined here:\n",
      " |  \n",
      " |  id = 1\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(Order)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# hex\n",
    "hex() 函数用于将10进制整数转换成16进制，以字符串形式表示。<br>\n",
    "语法：\n",
    "```python\n",
    "hex(x)\n",
    "```\n",
    "x -- 10进制整数<br>\n",
    "返回16进制数，以字符串形式表示。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(hex(13))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# id\n",
    "id() 函数用于获取对象的内存地址。<br>\n",
    "语法：\n",
    "```python\n",
    "id([object])\n",
    "```\n",
    "object -- 对象。<br>\n",
    "返回对象的内存地址。。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1672113168"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "id(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2048532128568"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "id(Order)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2048539668552"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "id(Order())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# input\n",
    "input() 函数接受一个标准输入数据，返回为 string 类型。<br>\n",
    "语法：\n",
    "```python\n",
    "input([prompt])\n",
    "```\n",
    "prompt: 提示信息<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入价格：1.2\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(input(\"请输入价格：\"))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# int\n",
    "int() 函数用于将一个字符串或数字转换为整型。<br>\n",
    "语法：\n",
    "```python\n",
    "int(x, base=10)\n",
    "```\n",
    "x -- 字符串或数字。<br>\n",
    "base -- 进制数，默认十进制。<br>\n",
    "返回整型数据。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "12\n"
     ]
    }
   ],
   "source": [
    "print(int(\"11\",11))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# isinstance\n",
    "isinstance() 函数来判断一个对象是否是一个已知的类型，类似 type()。<br>\n",
    ">isinstance() 与 type() 区别：\n",
    "* type() 不会认为子类是一种父类类型，不考虑继承关系。\n",
    "* isinstance() 会认为子类是一种父类类型，考虑继承关系。\n",
    "\n",
    ">如果要判断两个类型是否相同推荐使用 isinstance()。\n",
    "\n",
    "语法：\n",
    "```python\n",
    "isinstance(object, classinfo)\n",
    "```\n",
    "object -- 实例对象。<br>\n",
    "classinfo -- 可以是直接或间接类名、基本类型或者由它们组成的元组。<br>\n",
    "如果对象的类型与参数二的类型（classinfo）相同则返回 True，否则返回 False。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "int"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a=2\n",
    "type(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "isinstance(a,int)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 84,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "isinstance(a,float)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "isinstance(a,(list,float,str))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [],
   "source": [
    "class A():\n",
    "    pass\n",
    "class B(A):\n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "isinstance(A(),A)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(A())==A"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "isinstance(B(),A)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 95,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(B()) == A"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# issubclass\n",
    "issubclass() 方法用于判断参数 class 是否是类型参数 classinfo 的子类。<br>\n",
    "语法：\n",
    "```python\n",
    "issubclass(class, classinfo)\n",
    "```\n",
    "class -- 类。<br>\n",
    "classinfo -- 类。<br>\n",
    "如果 class 是 classinfo 的子类返回 True，否则返回 False。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 100,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "issubclass(B,A)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# iter\n",
    "iter() 函数用来生成迭代器。<br>\n",
    "语法：\n",
    "```python\n",
    "iter(object[, sentinel])\n",
    "```\n",
    "object -- 支持迭代的集合对象。<br>\n",
    "sentinel -- 如果传递了第二个参数，则参数 object 必须是一个可调用的对象（如，函数），此时，iter 创建了一个迭代器对象，每次调用这个迭代器对象的__next__()方法时，都会调用 object。<br>\n",
    "返回：迭代器对象。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "for i in iter(range(4)):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# len\n",
    "len() 方法返回对象（字符、列表、元组等）长度或项目个数。<br>\n",
    "语法：\n",
    "```python\n",
    "len( s )\n",
    "```\n",
    "s -- 对象。<br>\n",
    "返回：返回对象长度。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "11"
      ]
     },
     "execution_count": 102,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(range(11))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# list\n",
    "list() 方法用于将元组转换为列表。<br>\n",
    "注：元组与列表是非常类似的，区别在于元组的元素值不能修改，元组是放在括号中，列表是放于方括号中。<br>\n",
    "语法：\n",
    "```python\n",
    "list( seq )\n",
    "```\n",
    "seq -- 序列对象。<br>\n",
    "返回：返回列表。<br>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# locals\n",
    "locals() 函数会以字典类型返回当前位置的全部局部变量。<br>\n",
    "对于函数, 方法, lambda 函式, 类, 以及实现了 \\__call__ 方法的类实例, 它都返回 True。<br>\n",
    "语法：\n",
    "```python\n",
    "locals()\n",
    "```\n",
    "返回：返回字典类型的局部变量。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'z': 1, 'a': 11}\n"
     ]
    }
   ],
   "source": [
    "def show(a):\n",
    "    z=1\n",
    "    print(locals())\n",
    "show(11)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# map\n",
    "map() 会根据提供的函数对指定序列做映射。<br>\n",
    "第一个参数 function 以参数序列中的每一个元素调用 function 函数，返回包含每次 function 函数返回值的新列表。<br>\n",
    "语法：\n",
    "```python\n",
    "map(function, iterable, ...)\n",
    "```\n",
    "function -- 函数<br>\n",
    "iterable -- 一个或多个序列<br>\n",
    "返回迭代器。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100]"
      ]
     },
     "execution_count": 106,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(map(lambda x:x**2,range(11)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]"
      ]
     },
     "execution_count": 107,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(map(lambda x,y:x+y,range(11),range(11)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# max\n",
    "max() 方法返回给定参数的最大值，参数可以为序列。<br>\n",
    "语法：\n",
    "```python\n",
    "max( x, y, z, .... )\n",
    "```\n",
    "返回给定参数的最大值。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "14"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "max(12,11,14)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "max(range(11))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# memoryview\n",
    "memoryview() 函数返回给定参数的内存查看对象(Momory view)。<br>\n",
    "所谓内存查看对象，是指对支持缓冲区协议的数据进行包装，在不需要复制对象基础上允许Python代码访问。<br>\n",
    "语法：\n",
    "```python\n",
    "memoryview(obj)\n",
    "```\n",
    "返回元组列表。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "v=memoryview(bytearray(\"abcdefg\",'utf-8'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'a'"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chr(v[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['a', 'b', 'c', 'd', 'e', 'f', 'g']"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[chr(i) for i in v]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "b'abcdefg'"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "v.tobytes()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# min\n",
    "min() 方法返回给定参数的最小值，参数可以为序列。<br>\n",
    "语法：\n",
    "```python\n",
    "min( x, y, z, .... )\n",
    "```\n",
    "返回给定参数的最小值。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "11"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "min(11,12,14)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "min(range(11))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# next\n",
    "next() 返回迭代器的下一个项目。<br>\n",
    "语法：\n",
    "```python\n",
    "next(iterator[, default])\n",
    "```\n",
    "iterator -- 可迭代对象。<br>\n",
    "default -- 可选，用于设置在没有下一个元素时返回该默认值，如果不设置，又没有下一个元素则会触发 StopIteration 异常。<br><br>\n",
    "返回迭代器的下一个项目。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "iter(v, w): v must be callable",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-36-4667cee18bc2>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mit\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0miter\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m11\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'hello quant'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m: iter(v, w): v must be callable"
     ],
     "output_type": "error"
    }
   ],
   "source": [
    "it=iter(range(11))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'hello quant'"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "next(it,'hello quant')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# oct\n",
    "oct() 函数将一个整数转换成8进制字符串。<br>\n",
    "语法：\n",
    "```python\n",
    "oct(x)\n",
    "```\n",
    "x -- 整数。<br>\n",
    "返回8进制字符串。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'0o12'"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "oct(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# open\n",
    "open() 函数用于打开一个文件，创建一个 file 对象，相关的方法才可以调用它进行读写。<br>\n",
    "语法：\n",
    "```python\n",
    "open(name[, mode[, buffering]])\n",
    "```\n",
    "x -- 整数。<br>\n",
    "返回8进制字符串。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "python是一个很适合做量化投资的语言。\n",
      "那么为了做好量化投资，第一步就是学好python！\n"
     ]
    }
   ],
   "source": [
    "with open('D:\\programdev\\python\\pythonlearn\\log.txt') as f:\n",
    "    print(f.read())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# ord\n",
    "ord() 函数是 chr() 函数（对于8位的ASCII字符串）或 unichr() 函数（对于Unicode对象）的配对函数，它以一个字符（长度为1的字符串）作为参数，返回对应的 ASCII 数值，或者 Unicode 数值，如果所给的 Unicode 字符超出了你的 Python 定义范围，则会引发一个 TypeError 的异常。<br>\n",
    "语法：\n",
    "```python\n",
    "ord(c)\n",
    "```\n",
    "c -- 字符。<br>\n",
    "返回值是对应的十进制整数。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "97"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ord('a')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "20013"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ord(\"中\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# pow\n",
    "pow() 方法返回 xy（x的y次方） 的值。<br>\n",
    "语法：\n",
    "```python\n",
    "pow(x, y[, z])\n",
    "```\n",
    "函数是计算x的y次方，如果z在存在，则再对结果进行取模，其结果等效于pow(x,y) %z<br>\n",
    "返回 xy（x的y次方） 的值。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pow(2,3,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "2**3%3"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# print\n",
    "print() 方法用于打印输出，最常见的一个函数。<br>\n",
    "语法：\n",
    "```python\n",
    "print(*objects, sep=' ', end='\\n', file=sys.stdout)\n",
    "```\n",
    "objects -- 复数，表示可以一次输出多个对象。输出多个对象时，需要用 , 分隔。<br>\n",
    "sep -- 用来间隔多个对象，默认值是一个空格。<br>\n",
    "end -- 用来设定以什么结尾。默认值是换行符 \\n，我们可以换成其他字符串。<br>\n",
    "file -- 要写入的文件对象。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"D:\\programdev\\python\\pythonlearn\\log.txt\",'w') as f:\n",
    "    print(*range(11),sep='@',end='!',file=f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0@1@2@3@4@5@6@7@8@9@10!\n"
     ]
    }
   ],
   "source": [
    "with open('D:\\programdev\\python\\pythonlearn\\log.txt') as f:\n",
    "    print(f.read())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# property\n",
    "property() 函数的作用是在新式类中返回属性值。<br>\n",
    "语法：\n",
    "```python\n",
    "property([fget[, fset[, fdel[, doc]]]])\n",
    "```\n",
    "fget -- 获取属性值的函数<br>\n",
    "fset -- 设置属性值的函数<br>\n",
    "fdel -- 删除属性值函数<br>\n",
    "doc -- 属性描述信息<br>\n",
    "返回新式类属性。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "class C(object):\n",
    "    def __init__(self):\n",
    "        self._x=None\n",
    "    def getx(self):\n",
    "        return self._x\n",
    "    def setx(self,x):\n",
    "        self._x=x\n",
    "    def delx(self):\n",
    "        del self._x\n",
    "    x= property(getx,setx,delx,'i m a property')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "11\n"
     ]
    }
   ],
   "source": [
    "c=C()\n",
    "c.x=11# set\n",
    "print(c.x)# get"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [],
   "source": [
    "del c.x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'C' object has no attribute '_x'",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-63-628a1ebb8ea7>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mc\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;32m<ipython-input-59-23cef606b90b>\u001b[0m in \u001b[0;36mgetx\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m      3\u001b[0m         \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_x\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      4\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mgetx\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 5\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_x\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      6\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0msetx\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      7\u001b[0m         \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_x\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mAttributeError\u001b[0m: 'C' object has no attribute '_x'"
     ],
     "output_type": "error"
    }
   ],
   "source": [
    "c.x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [],
   "source": [
    "class B(object):\n",
    "    def __init__(self):\n",
    "        self._x=None\n",
    "    @property  \n",
    "    def x(self):\n",
    "        return self._x\n",
    "    @x.setter\n",
    "    def x(self,x):\n",
    "        self._x=x\n",
    "    @x.deleter\n",
    "    def x(self):\n",
    "        del self._x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "None\n"
     ]
    }
   ],
   "source": [
    "b=B()\n",
    "print(b.x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'hello quant'"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b.x='hello quant'\n",
    "b.x"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "这个代码和第一个例子完全相同，但要注意这些额外函数的名字和 property 下的一样，例如这里的 x。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# range\n",
    "range() 函数返回的是一个可迭代对象（类型是对象），而不是列表类型， 所以打印的时候不会打印列表。<br>\n",
    "语法：\n",
    "```python\n",
    "range(start, stop[, step])\n",
    "```\n",
    "start: 计数从 start 开始。默认是从 0 开始。例如range（5）等价于range（0， 5）;<br>\n",
    "stop: 计数到 stop 结束，但不包括 stop。例如：range（0， 5） 是[0, 1, 2, 3, 4]没有5<br>\n",
    "step：步长，默认为1。例如：range（0， 5） 等价于 range(0, 5, 1)<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "range"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(range(11))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(11))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# repr\n",
    "repr() 函数将对象转化为供解释器读取的形式。<br>\n",
    "语法：\n",
    "```python\n",
    "repr(object)\n",
    "```\n",
    "object -- 对象。<br>\n",
    "返回一个对象的 string 格式。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"'hello quant '\""
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "repr(\"hello quant \")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'hello quant '"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eval(repr(\"hello quant \"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(eval(repr(range(11))))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# reversed \n",
    "reversed 函数返回一个反转的迭代器。<br>\n",
    "语法：\n",
    "```python\n",
    "reversed(seq)\n",
    "```\n",
    "seq -- 要转换的序列，可以是 tuple, string, list 或 range。<br>\n",
    "返回一个反转的迭代器。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(reversed(range(11)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# round \n",
    "round() 方法返回浮点数x的四舍五入值。<br>\n",
    "语法：\n",
    "```python\n",
    "round( x [, n]  )\n",
    "```\n",
    "x -- 数字表达式。<br>\n",
    "n -- 表示从小数点位数，其中 x 需要四舍五入，默认值为 0。<br>\n",
    "返回浮点数x的四舍五入值。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "round(1.1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.2"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "round(1.15111,1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# set \n",
    "set() 函数创建一个无序不重复元素集，可进行关系测试，删除重复数据，还可以计算交集、差集、并集等。<br>\n",
    "语法：\n",
    "```python\n",
    "set([iterable])\n",
    "```\n",
    "iterable -- 可迭代对象对象；<br>\n",
    "返回新的集合对象。<br>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# setattr \n",
    "setattr 函数对应函数 getattr()，用于设置属性值，该属性必须存在。<br>\n",
    "语法：\n",
    "```python\n",
    "setattr(object, name, value)\n",
    "```\n",
    "object -- 对象。<br>\n",
    "name -- 字符串，对象属性。<br>\n",
    "value -- 属性值。<br>\n",
    "**相关：**has、get、del<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Order():\n",
    "    id=1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'hello q'"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "o=Order()\n",
    "setattr(o,'ids','hello q')\n",
    "o.ids"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['__class__',\n",
       " '__delattr__',\n",
       " '__dict__',\n",
       " '__dir__',\n",
       " '__doc__',\n",
       " '__eq__',\n",
       " '__format__',\n",
       " '__ge__',\n",
       " '__getattribute__',\n",
       " '__gt__',\n",
       " '__hash__',\n",
       " '__init__',\n",
       " '__init_subclass__',\n",
       " '__le__',\n",
       " '__lt__',\n",
       " '__module__',\n",
       " '__ne__',\n",
       " '__new__',\n",
       " '__reduce__',\n",
       " '__reduce_ex__',\n",
       " '__repr__',\n",
       " '__setattr__',\n",
       " '__sizeof__',\n",
       " '__str__',\n",
       " '__subclasshook__',\n",
       " '__weakref__',\n",
       " 'id',\n",
       " 'ids']"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dir(o)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# slice \n",
    "slice() 函数实现切片对象，主要用在切片操作函数里的参数传递。<br>\n",
    "语法：\n",
    "```python\n",
    "slice(stop)\n",
    "slice(start, stop[, step])\n",
    "```\n",
    "start -- 起始位置<br>\n",
    "stop -- 结束位置<br>\n",
    "step -- 间距<br>\n",
    "返回一个切片对象。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "slice(2, 6, None)"
      ]
     },
     "execution_count": 96,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s=slice(2,6)\n",
    "s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [],
   "source": [
    "r=range(11)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[2, 3, 4, 5]"
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(r[s])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# sorted \n",
    "sorted() 函数对所有可迭代的对象进行排序操作。<br>\n",
    ">sort 与 sorted 区别：<br>\n",
    "sort 是应用在 list 上的方法，sorted 可以对所有可迭代的对象进行排序操作。<br>\n",
    "list 的 sort 方法返回的是对已经存在的列表进行操作，而内建函数 sorted 方法返回的是一个新的 list，而不是在原来的基础上进行的操作。<br>\n",
    "\n",
    "语法：\n",
    "```python\n",
    "sorted(iterable, key=None, reverse=False)  \n",
    "```\n",
    "iterable -- 可迭代对象。<br>\n",
    "key -- 主要是用来进行比较的元素，只有一个参数，具体的函数的参数就是取自于可迭代对象中，指定可迭代对象中的一个元素来进行排序。<br>\n",
    "reverse -- 排序规则，reverse = True 降序 ， reverse = False 升序（默认）。<br>\n",
    "返回重新排序的列表。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
      ]
     },
     "execution_count": 100,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sorted(reversed(range(11)),reverse=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 3, 6, 9, 12, 15, 18, 1, 4, 7, 10, 13, 16, 19, 2, 5, 8, 11, 14, 17]"
      ]
     },
     "execution_count": 102,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sorted(range(20),key=lambda x: x%3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# staticmethod \n",
    "staticmethod 返回函数的静态方法。<br>\n",
    "语法：\n",
    "```python\n",
    "class C(object):\n",
    "    @staticmethod\n",
    "    def f(arg1, arg2, ...):\n",
    "        ...\n",
    "```\n",
    "以上实例声明了静态方法 f，类可以不用实例化就可以调用该方法 C.f()，当然也可以实例化后调用 C().f()。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {},
   "outputs": [],
   "source": [
    "class C(object):\n",
    "    @staticmethod\n",
    "    def show(word):\n",
    "        print(word)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "quant trade\n"
     ]
    }
   ],
   "source": [
    "C.show('quant trade')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "trade\n"
     ]
    }
   ],
   "source": [
    "C().show('trade')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# str \n",
    "str() 函数将对象转化为适于人阅读的形式。<br>\n",
    "语法：\n",
    "```python\n",
    "str(object='')\n",
    "```\n",
    "object -- 对象。<br>\n",
    "返回一个对象的string格式。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "''"
      ]
     },
     "execution_count": 108,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s='hello world'\n",
    "str(\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'hello world'"
      ]
     },
     "execution_count": 116,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str(s)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "总而言之，str出来的值是给人看的字符串，repr出来的值是给机器看的，括号中的任何内容出来后都是在它之上再加上一层引号。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# sum \n",
    "sum() 方法对系列进行求和计算。<br>\n",
    "语法：\n",
    "```python\n",
    "sum(iterable[, start])\n",
    "```\n",
    "iterable -- 可迭代对象，如：列表、元组、集合。<br>\n",
    "start -- 指定相加的参数，如果没有设置这个值，默认为0。<br>\n",
    "返回和。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "55"
      ]
     },
     "execution_count": 118,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sum(range(10),10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# super \n",
    "super() 函数是用于调用父类(超类)的一个方法。<br>\n",
    "语法：\n",
    "```python\n",
    "super(type[, object-or-type])\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# tuple  \n",
    "tuple 函数将列表转换为元组。<br>\n",
    "语法：\n",
    "```python\n",
    "tuple( seq )\n",
    "```\n",
    "seq -- 要转换为元组的序列。<br>\n",
    "返回元组。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tuple"
      ]
     },
     "execution_count": 120,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(tuple(range(11)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# type  \n",
    "type() 函数如果你只有第一个参数则返回对象的类型，三个参数返回新的类型对象。<br>\n",
    "语法：\n",
    "```python\n",
    "type(name, bases, dict)\n",
    "```\n",
    "name -- 类的名称。<br>\n",
    "bases -- 基类的元组。<br>\n",
    "dict -- 字典，类内定义的命名空间变量。<br>\n",
    "一个参数返回对象类型, 三个参数，返回新的类型对象。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "__main__.Order"
      ]
     },
     "execution_count": 122,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(Order())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 125,
   "metadata": {},
   "outputs": [],
   "source": [
    "O=type(\"O\",(),{'a':'hello quant'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'hello quant'"
      ]
     },
     "execution_count": 126,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "O.a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'hello quant'"
      ]
     },
     "execution_count": 133,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "o=O()\n",
    "o.a"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# vars  \n",
    "vars() 函数返回对象object的属性和属性值的字典对象。<br>\n",
    "语法：\n",
    "```python\n",
    "vars([object])\n",
    "```\n",
    "object -- 对象<br>\n",
    "返回对象object的属性和属性值的字典对象，如果没有参数，就打印当前调用位置的属性和属性值 类似 locals()。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'__name__': '__main__',\n",
       " '__doc__': 'Automatically created module for IPython interactive environment',\n",
       " '__package__': None,\n",
       " '__loader__': None,\n",
       " '__spec__': None,\n",
       " '__builtin__': <module 'builtins' (built-in)>,\n",
       " '__builtins__': <module 'builtins' (built-in)>,\n",
       " '_ih': ['',\n",
       "  'max(12,11,14)',\n",
       "  'max(*range(11))',\n",
       "  'max(range(11))',\n",
       "  'max(range(11))',\n",
       "  'v=memoryview(\"abcdefg\")',\n",
       "  'v=memoryview(bytearray(\"abcdefg\"),\\'utf-8\\')',\n",
       "  'v=memoryview(bytearray(\"abcdefg\",\\'utf-8\\'))',\n",
       "  'v[0]',\n",
       "  'char(v[0])',\n",
       "  'chr(v[0])',\n",
       "  'v[0]',\n",
       "  'chr(v[0])',\n",
       "  'v[1:3]',\n",
       "  'type(v[1:3])',\n",
       "  'chr(v[1:3])',\n",
       "  'chr(*v[1:3])',\n",
       "  'type(v[1:3])',\n",
       "  '[chr(i) for i in v]',\n",
       "  'v.tobytes()',\n",
       "  'min(11,12,14)',\n",
       "  'min(range(11))',\n",
       "  'it=iter(range(11))',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  \"it=iter(range(11),'hello quant')\",\n",
       "  \"next(it,'hello quant')\",\n",
       "  \"next(it,'hello quant')\",\n",
       "  'oct(10)',\n",
       "  \"with open('') as f:\\n    f.read()\",\n",
       "  \"with open('D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt') as f:\\n    f.read()\",\n",
       "  \"with open('D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt') as f:\\n    print(f.read())\",\n",
       "  \"with open('') as f:\\n    f.read()\",\n",
       "  \"with open('D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt') as f:\\n    print(f.read())\",\n",
       "  \"ord('a')\",\n",
       "  'ord(\"中\")',\n",
       "  'pow(2,3)',\n",
       "  'pow(2,3,3)',\n",
       "  '2**3',\n",
       "  '2**3%3',\n",
       "  \"print(range(11),'@','!')\",\n",
       "  \"print(*range(11),'@','!')\",\n",
       "  \"print(*range(11),'111','!')\",\n",
       "  \"print(*range(11),sep='111',end='!')\",\n",
       "  \"print(*range(11),'@','!')\",\n",
       "  \"print(*range(11),sep='@',end='!')\",\n",
       "  'with open(\"D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt\",\\'w\\') as f:\\n    print(*range(11),sep=\\'@\\',end=\\'!\\',file=f)',\n",
       "  \"with open('D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt') as f:\\n    print(f.read())\",\n",
       "  \"class C(object):\\n    def __init__(self):\\n        self._x=None\\n    def getx(self):\\n        return self._x\\n    def setx(self,x):\\n        self._x=x\\n    def delx(self):\\n        del self._x\\n    x= property(getx,setx,delx,'i m a property')\",\n",
       "  'c=C()\\nc.x=11\\nprint(c.x)',\n",
       "  'c=C()\\nc.x=11# set\\nprint(c.x)# get',\n",
       "  'del c.x',\n",
       "  'c.x',\n",
       "  'class B(object):\\n    def __init__(self):\\n        self._x=None\\n    @property  \\n    def x(self):\\n        return self._x\\n    @x.setter\\n    def setx(self,x):\\n        self._x=x\\n    @x.deleter\\n    def delx(self):\\n        del self._x',\n",
       "  'b=B()\\nprint(b.x)',\n",
       "  \"b.x='hello quant'\\nb.x\",\n",
       "  'class B(object):\\n    def __init__(self):\\n        self._x=None\\n    @property  \\n    def x(self):\\n        return self._x\\n    @x.setter\\n    def x(self,x):\\n        self._x=x\\n    @x.deleter\\n    def x(self):\\n        del self._x',\n",
       "  'b=B()\\nprint(b.x)',\n",
       "  \"b.x='hello quant'\\nb.x\",\n",
       "  'range(11)',\n",
       "  'type(range(11))',\n",
       "  'list(range(11))',\n",
       "  'repr(\"hello quant \")',\n",
       "  'eval(repr(\"hello quant \"))',\n",
       "  'repr(range(11))',\n",
       "  'list(eval(repr(range(11))))',\n",
       "  'reversed(range(11))',\n",
       "  'list(reversed(range(11)))',\n",
       "  'round()',\n",
       "  'round(1.1)',\n",
       "  'round(1.15111,1)',\n",
       "  'dir(A)',\n",
       "  'dir(Order)',\n",
       "  'class Order():\\n    id=1',\n",
       "  \"o=Order()\\nsetattr(o,'id','hello q')\\no.id\",\n",
       "  \"o=Order()\\nsetattr(o,'ids','hello q')\\no.id\",\n",
       "  \"o=Order()\\nsetattr(o,'ids','hello q')\\no.ids\",\n",
       "  'dir(Order)',\n",
       "  'dir(o)',\n",
       "  'dir(o)',\n",
       "  's=slice(5)',\n",
       "  's=slice(5)\\ns',\n",
       "  'r=range(11)',\n",
       "  'r[s]',\n",
       "  'list(r[s])',\n",
       "  's=slice(2,6)\\ns',\n",
       "  'r=range(11)',\n",
       "  'list(r[s])',\n",
       "  'sorted(reversed(range(11),reverse=False)',\n",
       "  'sorted(reversed(range(11)),reverse=False)',\n",
       "  'sorted(range(20),lambda x: x%3)',\n",
       "  'sorted(range(20),key=lambda x: x%3)',\n",
       "  'class C(object):\\n    @staticmethod\\n    def show(word):\\n        print(word)',\n",
       "  \"C.show('quant trade')\",\n",
       "  \"C().show('trade')\",\n",
       "  \"s='hello world'\\nstr(s)\",\n",
       "  \"s='hello world'\\nstr()\",\n",
       "  's=\\'hello world\\'\\nstr(\"\")',\n",
       "  'str(range(11))',\n",
       "  'repr(range(11))',\n",
       "  'repr(s)',\n",
       "  'str(s)',\n",
       "  'repr(s)',\n",
       "  'repr(range(11))',\n",
       "  'str(range(11))',\n",
       "  'str(s)',\n",
       "  'sum(range(10))',\n",
       "  'sum(range(10),10)',\n",
       "  'tuple(range(11))',\n",
       "  'type(tuple(range(11)))',\n",
       "  'type(Order)',\n",
       "  'type(Order())',\n",
       "  'type(\"O\",(),{\\'a\\':\\'hello quant\\'})',\n",
       "  'O.a',\n",
       "  'O=type(\"O\",(),{\\'a\\':\\'hello quant\\'})',\n",
       "  'O.a',\n",
       "  'o=O()\\no.a',\n",
       "  'vars()'],\n",
       " '_oh': {1: 14,\n",
       "  2: 10,\n",
       "  3: 10,\n",
       "  4: 10,\n",
       "  8: 97,\n",
       "  10: 'a',\n",
       "  11: 97,\n",
       "  12: 'a',\n",
       "  13: <memory at 0x0000022C5EB8B348>,\n",
       "  14: memoryview,\n",
       "  17: memoryview,\n",
       "  18: ['a', 'b', 'c', 'd', 'e', 'f', 'g'],\n",
       "  19: b'abcdefg',\n",
       "  20: 11,\n",
       "  21: 0,\n",
       "  23: 0,\n",
       "  24: 1,\n",
       "  25: 2,\n",
       "  26: 3,\n",
       "  27: 4,\n",
       "  28: 5,\n",
       "  29: 6,\n",
       "  30: 7,\n",
       "  31: 8,\n",
       "  32: 9,\n",
       "  33: 10,\n",
       "  37: 'hello quant',\n",
       "  38: 'hello quant',\n",
       "  39: '0o12',\n",
       "  45: 97,\n",
       "  46: 20013,\n",
       "  47: 8,\n",
       "  48: 2,\n",
       "  49: 8,\n",
       "  50: 2,\n",
       "  69: 'hello quant',\n",
       "  70: range(0, 11),\n",
       "  71: range,\n",
       "  72: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n",
       "  73: \"'hello quant '\",\n",
       "  74: 'hello quant ',\n",
       "  75: 'range(0, 11)',\n",
       "  76: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n",
       "  77: <range_iterator at 0x22c5eb6b730>,\n",
       "  78: [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],\n",
       "  80: 1,\n",
       "  81: 1.2,\n",
       "  85: 'hello q',\n",
       "  86: 1,\n",
       "  87: 'hello q',\n",
       "  88: ['__class__',\n",
       "   '__delattr__',\n",
       "   '__dict__',\n",
       "   '__dir__',\n",
       "   '__doc__',\n",
       "   '__eq__',\n",
       "   '__format__',\n",
       "   '__ge__',\n",
       "   '__getattribute__',\n",
       "   '__gt__',\n",
       "   '__hash__',\n",
       "   '__init__',\n",
       "   '__init_subclass__',\n",
       "   '__le__',\n",
       "   '__lt__',\n",
       "   '__module__',\n",
       "   '__ne__',\n",
       "   '__new__',\n",
       "   '__reduce__',\n",
       "   '__reduce_ex__',\n",
       "   '__repr__',\n",
       "   '__setattr__',\n",
       "   '__sizeof__',\n",
       "   '__str__',\n",
       "   '__subclasshook__',\n",
       "   '__weakref__',\n",
       "   'id'],\n",
       "  89: ['__class__',\n",
       "   '__delattr__',\n",
       "   '__dict__',\n",
       "   '__dir__',\n",
       "   '__doc__',\n",
       "   '__eq__',\n",
       "   '__format__',\n",
       "   '__ge__',\n",
       "   '__getattribute__',\n",
       "   '__gt__',\n",
       "   '__hash__',\n",
       "   '__init__',\n",
       "   '__init_subclass__',\n",
       "   '__le__',\n",
       "   '__lt__',\n",
       "   '__module__',\n",
       "   '__ne__',\n",
       "   '__new__',\n",
       "   '__reduce__',\n",
       "   '__reduce_ex__',\n",
       "   '__repr__',\n",
       "   '__setattr__',\n",
       "   '__sizeof__',\n",
       "   '__str__',\n",
       "   '__subclasshook__',\n",
       "   '__weakref__',\n",
       "   'id',\n",
       "   'ids'],\n",
       "  90: ['__class__',\n",
       "   '__delattr__',\n",
       "   '__dict__',\n",
       "   '__dir__',\n",
       "   '__doc__',\n",
       "   '__eq__',\n",
       "   '__format__',\n",
       "   '__ge__',\n",
       "   '__getattribute__',\n",
       "   '__gt__',\n",
       "   '__hash__',\n",
       "   '__init__',\n",
       "   '__init_subclass__',\n",
       "   '__le__',\n",
       "   '__lt__',\n",
       "   '__module__',\n",
       "   '__ne__',\n",
       "   '__new__',\n",
       "   '__reduce__',\n",
       "   '__reduce_ex__',\n",
       "   '__repr__',\n",
       "   '__setattr__',\n",
       "   '__sizeof__',\n",
       "   '__str__',\n",
       "   '__subclasshook__',\n",
       "   '__weakref__',\n",
       "   'id',\n",
       "   'ids'],\n",
       "  92: slice(None, 5, None),\n",
       "  94: range(0, 5),\n",
       "  95: [0, 1, 2, 3, 4],\n",
       "  96: slice(2, 6, None),\n",
       "  98: [2, 3, 4, 5],\n",
       "  100: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n",
       "  102: [0, 3, 6, 9, 12, 15, 18, 1, 4, 7, 10, 13, 16, 19, 2, 5, 8, 11, 14, 17],\n",
       "  106: 'hello world',\n",
       "  107: '',\n",
       "  108: '',\n",
       "  109: 'range(0, 11)',\n",
       "  110: 'range(0, 11)',\n",
       "  111: \"'hello world'\",\n",
       "  112: 'hello world',\n",
       "  113: \"'hello world'\",\n",
       "  114: 'range(0, 11)',\n",
       "  115: 'range(0, 11)',\n",
       "  116: 'hello world',\n",
       "  117: 45,\n",
       "  118: 55,\n",
       "  119: (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10),\n",
       "  120: tuple,\n",
       "  121: type,\n",
       "  122: __main__.Order,\n",
       "  123: __main__.O,\n",
       "  126: 'hello quant',\n",
       "  127: 'hello quant'},\n",
       " '_dh': ['D:\\\\programdev\\\\python\\\\pythonlearn'],\n",
       " 'In': ['',\n",
       "  'max(12,11,14)',\n",
       "  'max(*range(11))',\n",
       "  'max(range(11))',\n",
       "  'max(range(11))',\n",
       "  'v=memoryview(\"abcdefg\")',\n",
       "  'v=memoryview(bytearray(\"abcdefg\"),\\'utf-8\\')',\n",
       "  'v=memoryview(bytearray(\"abcdefg\",\\'utf-8\\'))',\n",
       "  'v[0]',\n",
       "  'char(v[0])',\n",
       "  'chr(v[0])',\n",
       "  'v[0]',\n",
       "  'chr(v[0])',\n",
       "  'v[1:3]',\n",
       "  'type(v[1:3])',\n",
       "  'chr(v[1:3])',\n",
       "  'chr(*v[1:3])',\n",
       "  'type(v[1:3])',\n",
       "  '[chr(i) for i in v]',\n",
       "  'v.tobytes()',\n",
       "  'min(11,12,14)',\n",
       "  'min(range(11))',\n",
       "  'it=iter(range(11))',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  'next(it)',\n",
       "  \"it=iter(range(11),'hello quant')\",\n",
       "  \"next(it,'hello quant')\",\n",
       "  \"next(it,'hello quant')\",\n",
       "  'oct(10)',\n",
       "  \"with open('') as f:\\n    f.read()\",\n",
       "  \"with open('D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt') as f:\\n    f.read()\",\n",
       "  \"with open('D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt') as f:\\n    print(f.read())\",\n",
       "  \"with open('') as f:\\n    f.read()\",\n",
       "  \"with open('D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt') as f:\\n    print(f.read())\",\n",
       "  \"ord('a')\",\n",
       "  'ord(\"中\")',\n",
       "  'pow(2,3)',\n",
       "  'pow(2,3,3)',\n",
       "  '2**3',\n",
       "  '2**3%3',\n",
       "  \"print(range(11),'@','!')\",\n",
       "  \"print(*range(11),'@','!')\",\n",
       "  \"print(*range(11),'111','!')\",\n",
       "  \"print(*range(11),sep='111',end='!')\",\n",
       "  \"print(*range(11),'@','!')\",\n",
       "  \"print(*range(11),sep='@',end='!')\",\n",
       "  'with open(\"D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt\",\\'w\\') as f:\\n    print(*range(11),sep=\\'@\\',end=\\'!\\',file=f)',\n",
       "  \"with open('D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt') as f:\\n    print(f.read())\",\n",
       "  \"class C(object):\\n    def __init__(self):\\n        self._x=None\\n    def getx(self):\\n        return self._x\\n    def setx(self,x):\\n        self._x=x\\n    def delx(self):\\n        del self._x\\n    x= property(getx,setx,delx,'i m a property')\",\n",
       "  'c=C()\\nc.x=11\\nprint(c.x)',\n",
       "  'c=C()\\nc.x=11# set\\nprint(c.x)# get',\n",
       "  'del c.x',\n",
       "  'c.x',\n",
       "  'class B(object):\\n    def __init__(self):\\n        self._x=None\\n    @property  \\n    def x(self):\\n        return self._x\\n    @x.setter\\n    def setx(self,x):\\n        self._x=x\\n    @x.deleter\\n    def delx(self):\\n        del self._x',\n",
       "  'b=B()\\nprint(b.x)',\n",
       "  \"b.x='hello quant'\\nb.x\",\n",
       "  'class B(object):\\n    def __init__(self):\\n        self._x=None\\n    @property  \\n    def x(self):\\n        return self._x\\n    @x.setter\\n    def x(self,x):\\n        self._x=x\\n    @x.deleter\\n    def x(self):\\n        del self._x',\n",
       "  'b=B()\\nprint(b.x)',\n",
       "  \"b.x='hello quant'\\nb.x\",\n",
       "  'range(11)',\n",
       "  'type(range(11))',\n",
       "  'list(range(11))',\n",
       "  'repr(\"hello quant \")',\n",
       "  'eval(repr(\"hello quant \"))',\n",
       "  'repr(range(11))',\n",
       "  'list(eval(repr(range(11))))',\n",
       "  'reversed(range(11))',\n",
       "  'list(reversed(range(11)))',\n",
       "  'round()',\n",
       "  'round(1.1)',\n",
       "  'round(1.15111,1)',\n",
       "  'dir(A)',\n",
       "  'dir(Order)',\n",
       "  'class Order():\\n    id=1',\n",
       "  \"o=Order()\\nsetattr(o,'id','hello q')\\no.id\",\n",
       "  \"o=Order()\\nsetattr(o,'ids','hello q')\\no.id\",\n",
       "  \"o=Order()\\nsetattr(o,'ids','hello q')\\no.ids\",\n",
       "  'dir(Order)',\n",
       "  'dir(o)',\n",
       "  'dir(o)',\n",
       "  's=slice(5)',\n",
       "  's=slice(5)\\ns',\n",
       "  'r=range(11)',\n",
       "  'r[s]',\n",
       "  'list(r[s])',\n",
       "  's=slice(2,6)\\ns',\n",
       "  'r=range(11)',\n",
       "  'list(r[s])',\n",
       "  'sorted(reversed(range(11),reverse=False)',\n",
       "  'sorted(reversed(range(11)),reverse=False)',\n",
       "  'sorted(range(20),lambda x: x%3)',\n",
       "  'sorted(range(20),key=lambda x: x%3)',\n",
       "  'class C(object):\\n    @staticmethod\\n    def show(word):\\n        print(word)',\n",
       "  \"C.show('quant trade')\",\n",
       "  \"C().show('trade')\",\n",
       "  \"s='hello world'\\nstr(s)\",\n",
       "  \"s='hello world'\\nstr()\",\n",
       "  's=\\'hello world\\'\\nstr(\"\")',\n",
       "  'str(range(11))',\n",
       "  'repr(range(11))',\n",
       "  'repr(s)',\n",
       "  'str(s)',\n",
       "  'repr(s)',\n",
       "  'repr(range(11))',\n",
       "  'str(range(11))',\n",
       "  'str(s)',\n",
       "  'sum(range(10))',\n",
       "  'sum(range(10),10)',\n",
       "  'tuple(range(11))',\n",
       "  'type(tuple(range(11)))',\n",
       "  'type(Order)',\n",
       "  'type(Order())',\n",
       "  'type(\"O\",(),{\\'a\\':\\'hello quant\\'})',\n",
       "  'O.a',\n",
       "  'O=type(\"O\",(),{\\'a\\':\\'hello quant\\'})',\n",
       "  'O.a',\n",
       "  'o=O()\\no.a',\n",
       "  'vars()'],\n",
       " 'Out': {1: 14,\n",
       "  2: 10,\n",
       "  3: 10,\n",
       "  4: 10,\n",
       "  8: 97,\n",
       "  10: 'a',\n",
       "  11: 97,\n",
       "  12: 'a',\n",
       "  13: <memory at 0x0000022C5EB8B348>,\n",
       "  14: memoryview,\n",
       "  17: memoryview,\n",
       "  18: ['a', 'b', 'c', 'd', 'e', 'f', 'g'],\n",
       "  19: b'abcdefg',\n",
       "  20: 11,\n",
       "  21: 0,\n",
       "  23: 0,\n",
       "  24: 1,\n",
       "  25: 2,\n",
       "  26: 3,\n",
       "  27: 4,\n",
       "  28: 5,\n",
       "  29: 6,\n",
       "  30: 7,\n",
       "  31: 8,\n",
       "  32: 9,\n",
       "  33: 10,\n",
       "  37: 'hello quant',\n",
       "  38: 'hello quant',\n",
       "  39: '0o12',\n",
       "  45: 97,\n",
       "  46: 20013,\n",
       "  47: 8,\n",
       "  48: 2,\n",
       "  49: 8,\n",
       "  50: 2,\n",
       "  69: 'hello quant',\n",
       "  70: range(0, 11),\n",
       "  71: range,\n",
       "  72: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n",
       "  73: \"'hello quant '\",\n",
       "  74: 'hello quant ',\n",
       "  75: 'range(0, 11)',\n",
       "  76: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n",
       "  77: <range_iterator at 0x22c5eb6b730>,\n",
       "  78: [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],\n",
       "  80: 1,\n",
       "  81: 1.2,\n",
       "  85: 'hello q',\n",
       "  86: 1,\n",
       "  87: 'hello q',\n",
       "  88: ['__class__',\n",
       "   '__delattr__',\n",
       "   '__dict__',\n",
       "   '__dir__',\n",
       "   '__doc__',\n",
       "   '__eq__',\n",
       "   '__format__',\n",
       "   '__ge__',\n",
       "   '__getattribute__',\n",
       "   '__gt__',\n",
       "   '__hash__',\n",
       "   '__init__',\n",
       "   '__init_subclass__',\n",
       "   '__le__',\n",
       "   '__lt__',\n",
       "   '__module__',\n",
       "   '__ne__',\n",
       "   '__new__',\n",
       "   '__reduce__',\n",
       "   '__reduce_ex__',\n",
       "   '__repr__',\n",
       "   '__setattr__',\n",
       "   '__sizeof__',\n",
       "   '__str__',\n",
       "   '__subclasshook__',\n",
       "   '__weakref__',\n",
       "   'id'],\n",
       "  89: ['__class__',\n",
       "   '__delattr__',\n",
       "   '__dict__',\n",
       "   '__dir__',\n",
       "   '__doc__',\n",
       "   '__eq__',\n",
       "   '__format__',\n",
       "   '__ge__',\n",
       "   '__getattribute__',\n",
       "   '__gt__',\n",
       "   '__hash__',\n",
       "   '__init__',\n",
       "   '__init_subclass__',\n",
       "   '__le__',\n",
       "   '__lt__',\n",
       "   '__module__',\n",
       "   '__ne__',\n",
       "   '__new__',\n",
       "   '__reduce__',\n",
       "   '__reduce_ex__',\n",
       "   '__repr__',\n",
       "   '__setattr__',\n",
       "   '__sizeof__',\n",
       "   '__str__',\n",
       "   '__subclasshook__',\n",
       "   '__weakref__',\n",
       "   'id',\n",
       "   'ids'],\n",
       "  90: ['__class__',\n",
       "   '__delattr__',\n",
       "   '__dict__',\n",
       "   '__dir__',\n",
       "   '__doc__',\n",
       "   '__eq__',\n",
       "   '__format__',\n",
       "   '__ge__',\n",
       "   '__getattribute__',\n",
       "   '__gt__',\n",
       "   '__hash__',\n",
       "   '__init__',\n",
       "   '__init_subclass__',\n",
       "   '__le__',\n",
       "   '__lt__',\n",
       "   '__module__',\n",
       "   '__ne__',\n",
       "   '__new__',\n",
       "   '__reduce__',\n",
       "   '__reduce_ex__',\n",
       "   '__repr__',\n",
       "   '__setattr__',\n",
       "   '__sizeof__',\n",
       "   '__str__',\n",
       "   '__subclasshook__',\n",
       "   '__weakref__',\n",
       "   'id',\n",
       "   'ids'],\n",
       "  92: slice(None, 5, None),\n",
       "  94: range(0, 5),\n",
       "  95: [0, 1, 2, 3, 4],\n",
       "  96: slice(2, 6, None),\n",
       "  98: [2, 3, 4, 5],\n",
       "  100: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n",
       "  102: [0, 3, 6, 9, 12, 15, 18, 1, 4, 7, 10, 13, 16, 19, 2, 5, 8, 11, 14, 17],\n",
       "  106: 'hello world',\n",
       "  107: '',\n",
       "  108: '',\n",
       "  109: 'range(0, 11)',\n",
       "  110: 'range(0, 11)',\n",
       "  111: \"'hello world'\",\n",
       "  112: 'hello world',\n",
       "  113: \"'hello world'\",\n",
       "  114: 'range(0, 11)',\n",
       "  115: 'range(0, 11)',\n",
       "  116: 'hello world',\n",
       "  117: 45,\n",
       "  118: 55,\n",
       "  119: (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10),\n",
       "  120: tuple,\n",
       "  121: type,\n",
       "  122: __main__.Order,\n",
       "  123: __main__.O,\n",
       "  126: 'hello quant',\n",
       "  127: 'hello quant'},\n",
       " 'get_ipython': <bound method InteractiveShell.get_ipython of <ipykernel.zmqshell.ZMQInteractiveShell object at 0x0000022C5E94C898>>,\n",
       " 'exit': <IPython.core.autocall.ZMQExitAutocall at 0x22c5eaa2a20>,\n",
       " 'quit': <IPython.core.autocall.ZMQExitAutocall at 0x22c5eaa2a20>,\n",
       " '_': 'hello quant',\n",
       " '__': 'hello quant',\n",
       " '___': __main__.O,\n",
       " '_i': 'o=O()\\no.a',\n",
       " '_ii': 'O.a',\n",
       " '_iii': 'O=type(\"O\",(),{\\'a\\':\\'hello quant\\'})',\n",
       " '_i1': 'max(12,11,14)',\n",
       " '_1': 14,\n",
       " '_i2': 'max(*range(11))',\n",
       " '_2': 10,\n",
       " '_i3': 'max(range(11))',\n",
       " '_3': 10,\n",
       " '_i4': 'max(range(11))',\n",
       " '_4': 10,\n",
       " '_i5': 'v=memoryview(\"abcdefg\")',\n",
       " '_i6': 'v=memoryview(bytearray(\"abcdefg\"),\\'utf-8\\')',\n",
       " '_i7': 'v=memoryview(bytearray(\"abcdefg\",\\'utf-8\\'))',\n",
       " 'v': <memory at 0x0000022C5EB8B408>,\n",
       " '_i8': 'v[0]',\n",
       " '_8': 97,\n",
       " '_i9': 'char(v[0])',\n",
       " '_i10': 'chr(v[0])',\n",
       " '_10': 'a',\n",
       " '_i11': 'v[0]',\n",
       " '_11': 97,\n",
       " '_i12': 'chr(v[0])',\n",
       " '_12': 'a',\n",
       " '_i13': 'v[1:3]',\n",
       " '_13': <memory at 0x0000022C5EB8B348>,\n",
       " '_i14': 'type(v[1:3])',\n",
       " '_14': memoryview,\n",
       " '_i15': 'chr(v[1:3])',\n",
       " '_i16': 'chr(*v[1:3])',\n",
       " '_i17': 'type(v[1:3])',\n",
       " '_17': memoryview,\n",
       " '_i18': '[chr(i) for i in v]',\n",
       " '_18': ['a', 'b', 'c', 'd', 'e', 'f', 'g'],\n",
       " '_i19': 'v.tobytes()',\n",
       " '_19': b'abcdefg',\n",
       " '_i20': 'min(11,12,14)',\n",
       " '_20': 11,\n",
       " '_i21': 'min(range(11))',\n",
       " '_21': 0,\n",
       " '_i22': 'it=iter(range(11))',\n",
       " 'it': <range_iterator at 0x22c5eb6be70>,\n",
       " '_i23': 'next(it)',\n",
       " '_23': 0,\n",
       " '_i24': 'next(it)',\n",
       " '_24': 1,\n",
       " '_i25': 'next(it)',\n",
       " '_25': 2,\n",
       " '_i26': 'next(it)',\n",
       " '_26': 3,\n",
       " '_i27': 'next(it)',\n",
       " '_27': 4,\n",
       " '_i28': 'next(it)',\n",
       " '_28': 5,\n",
       " '_i29': 'next(it)',\n",
       " '_29': 6,\n",
       " '_i30': 'next(it)',\n",
       " '_30': 7,\n",
       " '_i31': 'next(it)',\n",
       " '_31': 8,\n",
       " '_i32': 'next(it)',\n",
       " '_32': 9,\n",
       " '_i33': 'next(it)',\n",
       " '_33': 10,\n",
       " '_i34': 'next(it)',\n",
       " '_i35': 'next(it)',\n",
       " '_i36': \"it=iter(range(11),'hello quant')\",\n",
       " '_i37': \"next(it,'hello quant')\",\n",
       " '_37': 'hello quant',\n",
       " '_i38': \"next(it,'hello quant')\",\n",
       " '_38': 'hello quant',\n",
       " '_i39': 'oct(10)',\n",
       " '_39': '0o12',\n",
       " '_i40': \"with open('') as f:\\n    f.read()\",\n",
       " '_i41': \"with open('D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt') as f:\\n    f.read()\",\n",
       " 'f': <_io.TextIOWrapper name='D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt' mode='r' encoding='cp936'>,\n",
       " '_i42': \"with open('D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt') as f:\\n    print(f.read())\",\n",
       " '_i43': \"with open('') as f:\\n    f.read()\",\n",
       " '_i44': \"with open('D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt') as f:\\n    print(f.read())\",\n",
       " '_i45': \"ord('a')\",\n",
       " '_45': 97,\n",
       " '_i46': 'ord(\"中\")',\n",
       " '_46': 20013,\n",
       " '_i47': 'pow(2,3)',\n",
       " '_47': 8,\n",
       " '_i48': 'pow(2,3,3)',\n",
       " '_48': 2,\n",
       " '_i49': '2**3',\n",
       " '_49': 8,\n",
       " '_i50': '2**3%3',\n",
       " '_50': 2,\n",
       " '_i51': \"print(range(11),'@','!')\",\n",
       " '_i52': \"print(*range(11),'@','!')\",\n",
       " '_i53': \"print(*range(11),'111','!')\",\n",
       " '_i54': \"print(*range(11),sep='111',end='!')\",\n",
       " '_i55': \"print(*range(11),'@','!')\",\n",
       " '_i56': \"print(*range(11),sep='@',end='!')\",\n",
       " '_i57': 'with open(\"D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt\",\\'w\\') as f:\\n    print(*range(11),sep=\\'@\\',end=\\'!\\',file=f)',\n",
       " '_i58': \"with open('D:\\\\programdev\\\\python\\\\pythonlearn\\\\log.txt') as f:\\n    print(f.read())\",\n",
       " '_i59': \"class C(object):\\n    def __init__(self):\\n        self._x=None\\n    def getx(self):\\n        return self._x\\n    def setx(self,x):\\n        self._x=x\\n    def delx(self):\\n        del self._x\\n    x= property(getx,setx,delx,'i m a property')\",\n",
       " 'C': __main__.C,\n",
       " '_i60': 'c=C()\\nc.x=11\\nprint(c.x)',\n",
       " 'c': <__main__.C at 0x22c5ec4f2e8>,\n",
       " '_i61': 'c=C()\\nc.x=11# set\\nprint(c.x)# get',\n",
       " '_i62': 'del c.x',\n",
       " '_i63': 'c.x',\n",
       " '_i64': 'class B(object):\\n    def __init__(self):\\n        self._x=None\\n    @property  \\n    def x(self):\\n        return self._x\\n    @x.setter\\n    def setx(self,x):\\n        self._x=x\\n    @x.deleter\\n    def delx(self):\\n        del self._x',\n",
       " 'B': __main__.B,\n",
       " '_i65': 'b=B()\\nprint(b.x)',\n",
       " 'b': <__main__.B at 0x22c5ec6e198>,\n",
       " '_i66': \"b.x='hello quant'\\nb.x\",\n",
       " '_i67': 'class B(object):\\n    def __init__(self):\\n        self._x=None\\n    @property  \\n    def x(self):\\n        return self._x\\n    @x.setter\\n    def x(self,x):\\n        self._x=x\\n    @x.deleter\\n    def x(self):\\n        del self._x',\n",
       " '_i68': 'b=B()\\nprint(b.x)',\n",
       " '_i69': \"b.x='hello quant'\\nb.x\",\n",
       " '_69': 'hello quant',\n",
       " '_i70': 'range(11)',\n",
       " '_70': range(0, 11),\n",
       " '_i71': 'type(range(11))',\n",
       " '_71': range,\n",
       " '_i72': 'list(range(11))',\n",
       " '_72': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n",
       " '_i73': 'repr(\"hello quant \")',\n",
       " '_73': \"'hello quant '\",\n",
       " '_i74': 'eval(repr(\"hello quant \"))',\n",
       " '_74': 'hello quant ',\n",
       " '_i75': 'repr(range(11))',\n",
       " '_75': 'range(0, 11)',\n",
       " '_i76': 'list(eval(repr(range(11))))',\n",
       " '_76': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n",
       " '_i77': 'reversed(range(11))',\n",
       " '_77': <range_iterator at 0x22c5eb6b730>,\n",
       " '_i78': 'list(reversed(range(11)))',\n",
       " '_78': [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],\n",
       " '_i79': 'round()',\n",
       " '_i80': 'round(1.1)',\n",
       " '_80': 1,\n",
       " '_i81': 'round(1.15111,1)',\n",
       " '_81': 1.2,\n",
       " '_i82': 'dir(A)',\n",
       " '_i83': 'dir(Order)',\n",
       " '_i84': 'class Order():\\n    id=1',\n",
       " 'Order': __main__.Order,\n",
       " '_i85': \"o=Order()\\nsetattr(o,'id','hello q')\\no.id\",\n",
       " 'o': <__main__.O at 0x22c5ec7c588>,\n",
       " '_85': 'hello q',\n",
       " '_i86': \"o=Order()\\nsetattr(o,'ids','hello q')\\no.id\",\n",
       " '_86': 1,\n",
       " '_i87': \"o=Order()\\nsetattr(o,'ids','hello q')\\no.ids\",\n",
       " '_87': 'hello q',\n",
       " '_i88': 'dir(Order)',\n",
       " '_88': ['__class__',\n",
       "  '__delattr__',\n",
       "  '__dict__',\n",
       "  '__dir__',\n",
       "  '__doc__',\n",
       "  '__eq__',\n",
       "  '__format__',\n",
       "  '__ge__',\n",
       "  '__getattribute__',\n",
       "  '__gt__',\n",
       "  '__hash__',\n",
       "  '__init__',\n",
       "  '__init_subclass__',\n",
       "  '__le__',\n",
       "  '__lt__',\n",
       "  '__module__',\n",
       "  '__ne__',\n",
       "  '__new__',\n",
       "  '__reduce__',\n",
       "  '__reduce_ex__',\n",
       "  '__repr__',\n",
       "  '__setattr__',\n",
       "  '__sizeof__',\n",
       "  '__str__',\n",
       "  '__subclasshook__',\n",
       "  '__weakref__',\n",
       "  'id'],\n",
       " '_i89': 'dir(o)',\n",
       " '_89': ['__class__',\n",
       "  '__delattr__',\n",
       "  '__dict__',\n",
       "  '__dir__',\n",
       "  '__doc__',\n",
       "  '__eq__',\n",
       "  '__format__',\n",
       "  '__ge__',\n",
       "  '__getattribute__',\n",
       "  '__gt__',\n",
       "  '__hash__',\n",
       "  '__init__',\n",
       "  '__init_subclass__',\n",
       "  '__le__',\n",
       "  '__lt__',\n",
       "  '__module__',\n",
       "  '__ne__',\n",
       "  '__new__',\n",
       "  '__reduce__',\n",
       "  '__reduce_ex__',\n",
       "  '__repr__',\n",
       "  '__setattr__',\n",
       "  '__sizeof__',\n",
       "  '__str__',\n",
       "  '__subclasshook__',\n",
       "  '__weakref__',\n",
       "  'id',\n",
       "  'ids'],\n",
       " '_i90': 'dir(o)',\n",
       " '_90': ['__class__',\n",
       "  '__delattr__',\n",
       "  '__dict__',\n",
       "  '__dir__',\n",
       "  '__doc__',\n",
       "  '__eq__',\n",
       "  '__format__',\n",
       "  '__ge__',\n",
       "  '__getattribute__',\n",
       "  '__gt__',\n",
       "  '__hash__',\n",
       "  '__init__',\n",
       "  '__init_subclass__',\n",
       "  '__le__',\n",
       "  '__lt__',\n",
       "  '__module__',\n",
       "  '__ne__',\n",
       "  '__new__',\n",
       "  '__reduce__',\n",
       "  '__reduce_ex__',\n",
       "  '__repr__',\n",
       "  '__setattr__',\n",
       "  '__sizeof__',\n",
       "  '__str__',\n",
       "  '__subclasshook__',\n",
       "  '__weakref__',\n",
       "  'id',\n",
       "  'ids'],\n",
       " '_i91': 's=slice(5)',\n",
       " 's': 'hello world',\n",
       " '_i92': 's=slice(5)\\ns',\n",
       " '_92': slice(None, 5, None),\n",
       " '_i93': 'r=range(11)',\n",
       " 'r': range(0, 11),\n",
       " '_i94': 'r[s]',\n",
       " '_94': range(0, 5),\n",
       " '_i95': 'list(r[s])',\n",
       " '_95': [0, 1, 2, 3, 4],\n",
       " '_i96': 's=slice(2,6)\\ns',\n",
       " '_96': slice(2, 6, None),\n",
       " '_i97': 'r=range(11)',\n",
       " '_i98': 'list(r[s])',\n",
       " '_98': [2, 3, 4, 5],\n",
       " '_i99': 'sorted(reversed(range(11),reverse=False)',\n",
       " '_i100': 'sorted(reversed(range(11)),reverse=False)',\n",
       " '_100': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n",
       " '_i101': 'sorted(range(20),lambda x: x%3)',\n",
       " '_i102': 'sorted(range(20),key=lambda x: x%3)',\n",
       " '_102': [0,\n",
       "  3,\n",
       "  6,\n",
       "  9,\n",
       "  12,\n",
       "  15,\n",
       "  18,\n",
       "  1,\n",
       "  4,\n",
       "  7,\n",
       "  10,\n",
       "  13,\n",
       "  16,\n",
       "  19,\n",
       "  2,\n",
       "  5,\n",
       "  8,\n",
       "  11,\n",
       "  14,\n",
       "  17],\n",
       " '_i103': 'class C(object):\\n    @staticmethod\\n    def show(word):\\n        print(word)',\n",
       " '_i104': \"C.show('quant trade')\",\n",
       " '_i105': \"C().show('trade')\",\n",
       " '_i106': \"s='hello world'\\nstr(s)\",\n",
       " '_106': 'hello world',\n",
       " '_i107': \"s='hello world'\\nstr()\",\n",
       " '_107': '',\n",
       " '_i108': 's=\\'hello world\\'\\nstr(\"\")',\n",
       " '_108': '',\n",
       " '_i109': 'str(range(11))',\n",
       " '_109': 'range(0, 11)',\n",
       " '_i110': 'repr(range(11))',\n",
       " '_110': 'range(0, 11)',\n",
       " '_i111': 'repr(s)',\n",
       " '_111': \"'hello world'\",\n",
       " '_i112': 'str(s)',\n",
       " '_112': 'hello world',\n",
       " '_i113': 'repr(s)',\n",
       " '_113': \"'hello world'\",\n",
       " '_i114': 'repr(range(11))',\n",
       " '_114': 'range(0, 11)',\n",
       " '_i115': 'str(range(11))',\n",
       " '_115': 'range(0, 11)',\n",
       " '_i116': 'str(s)',\n",
       " '_116': 'hello world',\n",
       " '_i117': 'sum(range(10))',\n",
       " '_117': 45,\n",
       " '_i118': 'sum(range(10),10)',\n",
       " '_118': 55,\n",
       " '_i119': 'tuple(range(11))',\n",
       " '_119': (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10),\n",
       " '_i120': 'type(tuple(range(11)))',\n",
       " '_120': tuple,\n",
       " '_i121': 'type(Order)',\n",
       " '_121': type,\n",
       " '_i122': 'type(Order())',\n",
       " '_122': __main__.Order,\n",
       " '_i123': 'type(\"O\",(),{\\'a\\':\\'hello quant\\'})',\n",
       " '_123': __main__.O,\n",
       " '_i124': 'O.a',\n",
       " '_i125': 'O=type(\"O\",(),{\\'a\\':\\'hello quant\\'})',\n",
       " 'O': __main__.O,\n",
       " '_i126': 'O.a',\n",
       " '_126': 'hello quant',\n",
       " '_i127': 'o=O()\\no.a',\n",
       " '_127': 'hello quant',\n",
       " '_i128': 'vars()'}"
      ]
     },
     "execution_count": 128,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "vars()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "mappingproxy({'a': 'hello quant',\n",
       "              '__module__': '__main__',\n",
       "              '__dict__': <attribute '__dict__' of 'O' objects>,\n",
       "              '__weakref__': <attribute '__weakref__' of 'O' objects>,\n",
       "              '__doc__': None})"
      ]
     },
     "execution_count": 132,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "vars(O)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# zip  \n",
    "zip() 函数用于将可迭代的对象作为参数，将对象中对应的元素打包成一个个元组，然后返回由这些元组组成的列表。<br>\n",
    "如果各个迭代器的元素个数不一致，则返回列表长度与最短的对象相同，利用 * 号操作符，可以将元组解压为列表。<br>\n",
    "语法：\n",
    "```python\n",
    "zip([iterable, ...])\n",
    "```\n",
    "iterabl -- 一个或多个迭代器;<br>\n",
    "返回元组列表。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 139,
   "metadata": {},
   "outputs": [],
   "source": [
    "a=list(range(5))\n",
    "b=[i+1 for i in a]\n",
    "c=range(7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 138,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3, 4, 5]"
      ]
     },
     "execution_count": 138,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 142,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)]"
      ]
     },
     "execution_count": 142,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(zip(a,c))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 144,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(0, 1, 2, 3, 4), (1, 2, 3, 4, 5)]"
      ]
     },
     "execution_count": 144,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(zip(*list(zip(a,b))))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# \\__import__  \n",
    "\\__import__() 函数用于动态加载类和函数 。<br>\n",
    "如果一个模块经常变化就可以使用 \\__import__() 来动态载入。<br>\n",
    "语法：\n",
    "```python\n",
    "_import__(name[, globals[, locals[, fromlist[, level]]]])\n",
    "```\n",
    "name -- 模块名<br>\n",
    "返回元组列表。<br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 151,
   "metadata": {},
   "outputs": [],
   "source": [
    "os=__import__('os')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 152,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "module"
      ]
     },
     "execution_count": 152,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 156,
   "metadata": {},
   "outputs": [],
   "source": [
    "ls=[(\"abs()\",\"dict()\",\"help()\",\"min()\",\"setattr()\")\n",
    ",(\"all()\",\"dir()\",\"hex()\",\"next()\",\"slice()\")\n",
    ",(\"any()\",\"divmod()\",\"id()\",\"object()\",\"sorted()\")\n",
    ",(\"ascii()\",\"enumerate()\",\"input()\",\"oct()\",\"staticmethod()\")\n",
    ",(\"bin()\",\"eval()\",\"int()\",\"open()\",\"str()\")\n",
    ",(\"bool()\",\"exec()\",\"isinstance()\",\"ord()\",\"sum()\")\n",
    ",(\"bytearray()\",\"filter()\",\"issubclass()\",\"pow()\",\"super()\")\n",
    ",(\"bytes()\",\"float()\",\"iter()\",\"print()\",\"tuple()\")\n",
    ",(\"callable()\",\"format()\",\"len()\",\"property()\",\"type()\")\n",
    ",(\"chr()\",\"frozenset()\",\"list()\",\"range()\",\"vars()\")\n",
    ",(\"classmethod()\",\"getattr()\",\"locals()\",\"repr()\",\"zip()\")\n",
    ",(\"compile()\",\"globals()\",\"map()\",\"reversed()\",\"__import__()\")\n",
    ",(\"complex()\",\"hasattr()\",\"max()\",\"round()\",\"\")\n",
    ",(\"delattr()\",\"hash()\",\"memoryview()\",\"set()\",\"\")]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 158,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('abs()', 'dict()', 'help()', 'min()', 'setattr()'),\n",
       " ('all()', 'dir()', 'hex()', 'next()', 'slice()'),\n",
       " ('any()', 'divmod()', 'id()', 'object()', 'sorted()'),\n",
       " ('ascii()', 'enumerate()', 'input()', 'oct()', 'staticmethod()'),\n",
       " ('bin()', 'eval()', 'int()', 'open()', 'str()'),\n",
       " ('bool()', 'exec()', 'isinstance()', 'ord()', 'sum()'),\n",
       " ('bytearray()', 'filter()', 'issubclass()', 'pow()', 'super()'),\n",
       " ('bytes()', 'float()', 'iter()', 'print()', 'tuple()'),\n",
       " ('callable()', 'format()', 'len()', 'property()', 'type()'),\n",
       " ('chr()', 'frozenset()', 'list()', 'range()', 'vars()'),\n",
       " ('classmethod()', 'getattr()', 'locals()', 'repr()', 'zip()'),\n",
       " ('compile()', 'globals()', 'map()', 'reversed()', '__import__()'),\n",
       " ('complex()', 'hasattr()', 'max()', 'round()', ''),\n",
       " ('delattr()', 'hash()', 'memoryview()', 'set()', '')]"
      ]
     },
     "execution_count": 158,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ls"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
